function gotophp() {

	this.location = "index.php";
}


function fillFormElement(mymenu,thefield) {

	target = document.getElementById( thefield );
	target.value = mymenu.value;
	mymenu.selectedIndex = 0;
	target.focus();

}

function fillFormElementPlus(mymenu,thefield) {

	target = document.getElementById( thefield );
	target.value = target.value + " " +  mymenu.value;
	mymenu.selectedIndex = 0;
	target.focus();

}


function fillDateInField(thefield) {
	
	d = new date();
	target = document.getElementById( thefield );
	target.value = d;
}


function asktodelete() {
	
	var msg = "Are you sure you want to delete this item?";
	
	if(confirm(msg)) {
		return true;
	} else {
		return false;
	}
	
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;




function checkIt(string)
{
		place = detect.indexOf(string) + 1;
		thestring = string;
		return place;
}

function initEditorCheck() {

	if (!checkIt('safari')) 
	{
		initEditor();
	}

}

function hideRouteStuff() {
 		
		element = document.getElementById("startlocation");
		element.style.display = "none";
		element = document.getElementById("startregiontext");
		element.style.display = "none";
		
	}
	
function hideTheMenus() {
 		
		element = document.getElementById("samplehowhear1");
		element.style.display = "none";

		element = document.getElementById("samplehowhear2");
		element.style.display = "none";

		element = document.getElementById("samplehowhear3");
		element.style.display = "none";		

		element = document.getElementById("howhear");
		element.style.display = "none";
		element.value = "";
		
		element = document.getElementById("mi");
		if (element) { element.style.display = "none"; }	

		element = document.getElementById("sc");
		if (element) {element.style.display = "none"; }
		
	}
	
function switchSecondMenu(mymenu, myname) {

	element = document.getElementById("howhear");
	element.style.display = "none";	

	element = document.getElementById("mi");
	element.style.display = "none";	


	
	switch (myname) {
	
		case "samplehowhear1":


			switch (mymenu.value) {
		
			case "Referred by a Friend - Non LATC Member":
				
				element = document.getElementById("howhear");
				element.style.display = "block";				
				element = document.getElementById("mi");
				element.style.display = "block";	
				break;		

			case "In a store":
				
				element = document.getElementById("howhear");
				element.style.display = "block";				
				element = document.getElementById("mi");
				element.style.display = "block";		
				break;	
				
				
			case "Other":
				
				element = document.getElementById("howhear");
				element.style.display = "block";				
				element = document.getElementById("mi");
				element.style.display = "block";		
				break;	
				
			default:
				element = document.getElementById("sc");
				element.style.display = "block";	
				break;
			}
		
			break;

		case "samplehowhear3":


			switch (mymenu.value) {
		
			case "Other":
				
				element = document.getElementById("howhear");
				element.style.display = "block";				
				element = document.getElementById("mi");
				element.style.display = "block";		
				break;		
			
			default:
				element = document.getElementById("sc");
				element.style.display = "block";					
				break;
			}
			
		default:
		
			break;
		}				
		


	
}

function checkOtherRoute(mymenu) {
	
	hideRouteStuff();
	
	switch (mymenu.value) {
		
	case "100":
			element = document.getElementById("startlocation");
			element.style.display = "block";				
			
			element = document.getElementById("startregiontext");
			element.style.display = "block";				
			break;

		default:
		
			break;
		}	

}	
	
function checkHowHear(mymenu) {
	
	hideTheMenus();
	
	switch (mymenu.value) {
	
		case "Word of Mouth":
			
			element = document.getElementById("samplehowhear1");
			element.style.display = "block";				
			element = document.getElementById("sc");
			element.style.display = "block";	
			break;

		case "Saw at a Race":
			
			element = document.getElementById("howhear");
			element.style.display = "block";				
			element = document.getElementById("mi");
			element.style.display = "block";	
			break;

		case "Offline Advertisement":
			
			element = document.getElementById("samplehowhear2");
			element.style.display = "block";				
			element = document.getElementById("sc");
			element.style.display = "block";	
			break;

		case "Other Web Site":
			
			element = document.getElementById("howhear");
			element.style.display = "block";				
			element = document.getElementById("mi");
			element.style.display = "block";	
			break;

		case "Internet Search":
			
			element = document.getElementById("samplehowhear3");
			element.style.display = "block";				
			element = document.getElementById("sc");
			element.style.display = "block";	
			break;	

		case "Other":
			
			element = document.getElementById("howhear");
			element.style.display = "block";				
			element = document.getElementById("mi");
			element.style.display = "block";	
			break;
			
		default:
		
			break;
		}

}


//2006-08-29 added to replace existing 'How Hear' functionality
function showField()
{
    var choice = document.edit.samplehowhear.options[document.edit.samplehowhear.selectedIndex].value;

    document.all['howhear'].value = "";
    document.all['samplehowhear1'].value = "";
    document.all['samplehowhear2'].value = "";
    document.all['samplehowhear3'].value = "";
    
    if(choice == "Word of Mouth")
    {
        document.all['other-div'].style.display = "none";
        document.all['subcat'].style.display = "";
        document.all['samplehowhear1'].style.display = "";
        document.all['subcat2'].style.display = "none";
        document.all['samplehowhear2'].style.display = "none";
        document.all['subcat3'].style.display = "none";
        document.all['samplehowhear3'].style.display = "none";
    }

    else if(choice == "Saw at a Race")
    {
        document.all['other-div'].style.display = "";
        document.all['howhear'].style.display = "";
        document.all['subcat'].style.display = "none";
        document.all['samplehowhear1'].style.display = "none";
        document.all['subcat2'].style.display = "none";
        document.all['samplehowhear2'].style.display = "none";
        document.all['subcat3'].style.display = "none";
        document.all['samplehowhear3'].style.display = "none";
    }

    else if(choice == "Offline Advertisement")
    {
    		document.all['other-div'].style.display = "none";
    		document.all['howhear'].style.display = "none";
        document.all['subcat'].style.display = "none";
        document.all['samplehowhear1'].style.display = "none";
        document.all['subcat2'].style.display = "";
        document.all['samplehowhear2'].style.display = "";
        document.all['subcat3'].style.display = "none";
        document.all['samplehowhear3'].style.display = "none";
    }
    
    else if(choice == "Other Web Site")
    {
    		document.all['other-div'].style.display = "";
    		document.all['howhear'].style.display = "";
        document.all['subcat'].style.display = "none";
        document.all['samplehowhear1'].style.display = "none";
        document.all['subcat2'].style.display = "none";
        document.all['samplehowhear2'].style.display = "none";
        document.all['subcat3'].style.display = "none";
        document.all['samplehowhear3'].style.display = "none";
    }
    
    else if(choice == "Internet Search")
    {
    		document.all['other-div'].style.display = "none";
    		document.all['howhear'].style.display = "none";
        document.all['subcat'].style.display = "none";
        document.all['samplehowhear1'].style.display = "none";
        document.all['subcat2'].style.display = "none";
        document.all['samplehowhear2'].style.display = "none";
        document.all['subcat3'].style.display = "";
        document.all['samplehowhear3'].style.display = "";
    }
 
    else
    {
        document.all['other-div'].style.display = "none";
        document.all['howhear'].style.display = "none";
        document.all['subcat'].style.display = "none";
        document.all['samplehowhear1'].style.display = "none";
        document.all['subcat2'].style.display = "none";
        document.all['samplehowhear2'].style.display = "none";
        document.all['subcat3'].style.display = "none";
        document.all['samplehowhear3'].style.display = "none";
    }
}

function showSubField1() {

	var choice = document.edit.samplehowhear1.options[document.edit.samplehowhear1.selectedIndex].value;

	if((choice == "Referred by a Friend - Non LATC Member") || (choice == "Referred by a Friend - Non LATC Member") || (choice == "In a store") || (choice == "Other"))
	{
		document.all['other-div'].style.display = "";
		document.all['howhear'].style.display = "";
		document.all['subcat2'].style.display = "none";
		document.all['samplehowhear2'].style.display = "none";
    document.all['subcat3'].style.display = "none";
    document.all['samplehowhear3'].style.display = "none";
    document.all['howhear'].value = "";
    document.all['samplehowhear2'].value = "";
    document.all['samplehowhear3'].value = "";
    
	}
	
	else
	{
		document.all['other-div'].style.display = "none";
		document.all['howhear'].style.display = "none";
    document.all['subcat2'].style.display = "none";
    document.all['samplehowhear2'].style.display = "none";
    document.all['subcat3'].style.display = "none";
    document.all['samplehowhear3'].style.display = "none";
    document.all['howhear'].value = "";
    document.all['samplehowhear2'].value = "";
    document.all['samplehowhear3'].value = "";
	}
}

function showSubField3() {

	var choice = document.edit.samplehowhear3.options[document.edit.samplehowhear3.selectedIndex].value;

	if(choice == "Other")
	{
		document.all['other-div'].style.display = "";
		document.all['howhear'].style.display = "";
		document.all['subcat'].style.display = "none";
		document.all['samplehowhear2'].style.display = "none";
    document.all['subcat2'].style.display = "none";
    document.all['samplehowhear2'].style.display = "none";
    document.all['howhear'].value = "";
    document.all['samplehowhear1'].value = "";
    document.all['samplehowhear2'].value = "";
	}
	
	else
	{
		document.all['other-div'].style.display = "none";
		document.all['howhear'].style.display = "none";
    document.all['subcat'].style.display = "none";
    document.all['samplehowhear1'].style.display = "none";
    document.all['subcat2'].style.display = "none";
    document.all['samplehowhear2'].style.display = "none";
    document.all['howhear'].value = "";
    document.all['samplehowhear1'].value = "";
    document.all['samplehowhear2'].value = "";
	}
}
// end of 'How Hear' functionality
