ddsmoothmenu.init({
    mainmenuid: "smoothmenu1", //menu DIV id
    orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
    classname: 'ddsmoothmenu', //class added to menu's outer DIV
    //customtheme: ["#1c5a80", "#18374a"],
    contentsource: ["topMenu", "include/topmenu.htm?1"] //"markup" or ["container_id", "path_to_menu_file"]
})
	
/* Opens window to apply for a position */
function OpenAppWin(jobID)
{
	window.open("careerSubmit.aspx?ID="+jobID, "JobApplication",'scrollbars,resizable,width=700,height=600,left=300,top=100'); 
} 
function focusControl(controlName)
{
	var frm = window.document.forms[0];
	var controlIndex = getIndexOfControl(frm,controlName);
	frm.elements[controlIndex].focus();
}
function clickButton(controlName)
{
	var frm = window.document.forms[0];
	var buttonIndex = getIndexOfControl(frm,controlName);

	frm.elements[buttonIndex].click();
}
function getIndexOfControl(frm, valueToSearchFor)
{
	if(frm == null || frm == ''){
		frm = window.document.forms[0];
	}
	var index = -1, i = 0, found = false;
    while ( i < frm.length && index == -1 ) {
		
		if ( frm.elements[i].name.indexOf(valueToSearchFor) != -1 || frm.elements[i].name == valueToSearchFor) {
            index = i;
        } else {
            i++;
        }
    }
    return index;

}
//submit search from header
function submitSearch(flag)
{
	frm = window.document.forms[0];
	if(frm.HeaderSearchTerms.value.length <2)
	{
			alert('The search word must contain more than 1 character')
			return false;
	}
	else
	{
		if(flag == "true")
			{
			frm.submit();
			}
		else
			return true; 
	}
}	

function validateCheckBoxes()
{
	frm = window.document.forms[0];
	frm.elements[getIndexOfControl(frm,'txt_QuestionsValid')].value = "Yes";
	frm.elements[getIndexOfControl(frm,'txt_QuestionsEmpty')].value = "";
	
	
	var numOfChecked = 0;
	//first check if they all have been set, true or false
	for(var x = 0; x < frm.length; x++) 
	{
	
		if(frm.elements[x].type == 'radio')
		{
			if(frm.elements[x].checked == false && frm.elements[x+1].checked == false)
			{
				
				return;
			}
			else
			{
				x++;
			}
		}
	}
	
	frm.elements[getIndexOfControl(frm,'txt_QuestionsEmpty')].value = "Yes";
	frm.elements[getIndexOfControl(frm,'txt_QuestionsValid')].value = "";
	//then check if any have value 0
	for(var x = 0; x < frm.length; x++) 
    {
    	if(frm.elements[x].type == 'radio')
		{
			if(frm.elements[x].value == '0' && frm.elements[x].checked == true)
			{
				return;
			}
		}
    }
    
    frm.elements[getIndexOfControl(frm,'txt_QuestionsValid')].value = "Yes";
    

}

function CreateFlashObject(nameFlash, flashWidth, flashHeight, bgcolor)

{
    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+flashWidth+'" height="'+flashHeight+'" id="splash" align="middle" VIEWASTEXT >\n');
	document.write('<param name="movie" value="splash/'+nameFlash+'" />\n');
	document.write('<param name="quality" value="high" />\n');
	document.write('<param name="wmode" value="transparent" />\n');
	if (bgcolor != null && bgcolor != "")
	{
	document.write('<param name="bgcolor" value="'+bgcolor+'" />\n');
	document.write('<embed src="splash/'+nameFlash+'" quality="high" wmode="transparent" bgcolor="'+bgcolor+'" width="'+flashWidth+'" height="'+flashHeight+'" name="splash" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');


	}
	else {
		document.write('<embed src="splash/'+nameFlash+'" quality="high" wmode="transparent" width="'+flashWidth+'" height="'+flashHeight+'" name="splash" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
			}
    document.write('</object>\n');
}

