// function to change the background image of two cells and the style of the navigation text (only used for navigation)
function mOver(id1,id2,image,nav,navStyle,navValue){
	if(document.getElementById(id1)){
		if(image.indexOf("#")==0 || image=="transparent") {
			document.getElementById(id1).style.backgroundColor = image;
		} else {
			document.getElementById(id1).style.backgroundImage = "url("+image+")";
		}
	}
	if(document.getElementById(id2)){
		if(image.indexOf("#")==0 || image=="transparent") {
			document.getElementById(id2).style.backgroundColor = image;
		} else {
			document.getElementById(id2).style.backgroundImage = "url("+image+")";
		}
	}
	if(document.getElementById(nav)){
		strNav = 'document.getElementById("'+nav+'").style.'+navStyle+' = "'+navValue+'"';
		eval(strNav);
	}
}

//function to open a popup window with different attributes
function show_popup(gifurl,gifname,wd,ht,rs,mb,tb,lo,st,sb,x){
	
	var lf=(screen.width) ? (screen.width-wd)/2 : 0;
	var tp=(screen.height) ? (screen.height-ht)/2 : 0;
	
		if(!wd||!ht){
			var ha=((mb=='yes')?30:0)+((tb=='yes')?60:0)+((lo=='yes')?20:0)+((st=='yes')?20:0);wd=600;ht=400-ha;if(ver4){
				if(screen.availWidth){
					wd=screen.availWidth-20;ht=screen.availHeight-65-ha;lf=screen.availLeft;tp=screen.availTop+10;
				}
			}
		} 
	window.open(gifurl,gifname,'width='+wd+',height='+ht+',left='+lf+',top='+tp+',resizable='+rs+',menubar='+mb+',toolbar='+tb+',location='+lo+',status='+st+',scrollbars='+sb+x);
} 

// checks the basic contact form fields
function checkFields(){
		if (document.contactus.First_Name.value == ""){
			alert("Your First Name is required");
			return false;
	}	
		if (document.contactus.Last_Name.value == ""){
			alert("Your Last Name is required");
			return false;
	}	
		if (document.contactus.Email_Address.value == "" || (document.contactus.Email_Address.value.indexOf("@",0) == -1||document.contactus.Email_Address.value.indexOf(".",0) == -1)) { 
			alert("Please enter a valid E-mail address");
			return false;
	}
		if (document.contactus.comments.value == ""){
			alert("Your Comments are required");
			return false;
	}	
}

// checks the request live demo contact form fields
function checkRequest(){
		if (document.frmRequest.first_name.value == ""){
			alert("Your First Name is required");
			return false;
	}	
		if (document.frmRequest.last_name.value == ""){
			alert("Your Last Name is required");
			return false;
	}	
		if (document.frmRequest.company.value == ""){
			alert("Your Company Name is required");
			return false;
	}	
		if (document.frmRequest.email.value == "" || (document.frmRequest.email.value.indexOf("@",0) == -1||document.frmRequest.email.value.indexOf(".",0) == -1)) { 
			alert("Please enter a valid E-mail address");
			return false;
	}
		if (document.frmRequest.phone.value == ""){
			alert("Your Phone Number is required");
			return false;
	}	
		if (document.frmRequest.street.value == ""){
			alert("Your Address is required");
			return false;
	}	
		if (document.frmRequest.city.value == ""){
			alert("Your City is required");
			return false;
	}	
		if (document.frmRequest.country.value == ""){
			alert("Your Country is required");
			return false;
	}	
		if (document.frmRequest.state.value == ""){
			alert("Your State/Province is required");
			return false;
	}	
		if (document.frmRequest.zip.value == ""){
			alert("Your Zip/Postal Code is required");
			return false;
	}	
		/*if (document.frmRequest.00N00000006oxh5.value == ""){
			alert("Your Industry is required");
			return false;
	}	
		if (document.frmRequest.00N00000006oxm5.value == ""){
			alert("Your Current POS Provider is required");
			return false;
	}	
		if (document.frmRequest.00N00000006p29o.value == ""){
			alert("Your Business Model is required");
			return false;
	}	*/
}

// preloads images for rollovers (3 functions)
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		//button_background_over = newImage("/images/button-background-over.gif");
		preloadFlag = true;
	}
}


// functions to make png graphics with transparent show up properly in IE 5.5 to 6.*
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

function fixPNG(){
	for(i=0; i<document.images.length; i++){
		type = document.images[i].src;
		type = type.substring(type.length-3, type.length);
		if(type == "png"){
			if ((version >= 5.5) && (version < 7) && (document.body.filters)){
				document.images[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + document.images[i].src + "', sizingMethod='scale')"
				document.images[i].src = "http://www.myhalo.com/images/dotblank.gif"
			}
		}
	}
	
}
function changePNG(img, replace){
	if ((version >= 5.5) && (version < 7) && (document.body.filters)){
		document[img].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + replace + "', sizingMethod='scale')";
	} else {
		document[img].src = replace;
	}
}

//open a new window with specified features
function show_popup(gifurl,gifname,wd,ht,rs,mb,tb,lo,st,sb,x){
	var lf=0;
	var tp=0;
		if(!wd||!ht){
			var ha=((mb=='yes')?30:0)+((tb=='yes')?60:0)+((lo=='yes')?20:0)+((st=='yes')?20:0);wd=600;ht=400-ha;if(ver4){
				if(screen.availWidth){
					wd=screen.availWidth-20;ht=screen.availHeight-65-ha;lf=screen.availLeft;tp=screen.availTop+10;
				}
			}
		} 
	window.open(gifurl,gifname,'width='+wd+',height='+ht+',left='+lf+',top='+tp+',resizable='+rs+',menubar='+mb+',toolbar='+tb+',location='+lo+',status='+st+',scrollbars='+sb+x);
}

//validate the email address on the price calculator form
function checkCalcForm(){
		if (document.form1.txtEmail.value == "" || (document.form1.txtEmail.value.indexOf("@",0) == -1||document.form1.txtEmail.value.indexOf(".",0) == -1)) { 
			alert("Please enter a valid E-mail address");
			return false;
		}
}

//validate the email address on the second price calculator form
function checkCalcForm2(){

		if (document.form1.first_name.value == ""){
			alert("Your First Name is required");
			return false;
	}	
		if (document.form1.last_name.value == ""){
			alert("Your Last Name is required");
			return false;
	}	
		if (document.form1.Company.value == ""){
			alert("Your Company is required");
			return false;
	}	
		if (document.form1.telephone.value == ""){
			alert("Your Phone Number is required");
			return false;
	}	
		if (document.form1.txtEmail.value == "" || (document.form1.txtEmail.value.indexOf("@",0) == -1||document.form1.txtEmail.value.indexOf(".",0) == -1)) { 
			alert("Please enter a valid E-mail address");
			return false;
	}
}

function flashCalendar( flashFile ){
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="562" height="571" title="Calendar"><param name="movie" value="http://www.myhalo.com/files/flash/calendars/'+flashFile+'" /><param name="quality" value="high" /><param name="wmode" value="transparent"><embed src="http://www.myhalo.com/files/flash/calendars/'+flashFile+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="562" height="572" wmode="transparent"></embed></object>');
}

function flashMovie( flashFile, wNum, hNum ){
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width='+wNum+' height='+hNum+' id="main2" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="http://www.myhalo.com/files/Movies/'+flashFile+'" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="http://www.myhalo.com/files/Movies/'+flashFile+'" quality="high" bgcolor="#ffffff" width='+wNum+' height='+hNum+' name="main2" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
}

 