function mOver(id1,id2,image,nav,navStyle,navValue){
	if(document.getElementById(id1)){
		if(image.indexOf("#") == 0) {
			document.getElementById(id1).style.backgroundColor = image;
		} else {
			document.getElementById(id1).style.backgroundImage = "url("+image+")";
		}
	}
	if(document.getElementById(id2)){
		if(image.indexOf("#") == 0) {
			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 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);
} 


function ContactForm(){
		if (document.contactus.First_Name.value == ""){
			alert("Your firstname is required");
			return false;
	}	
	    if (document.contactus.Last_Name.value == ""){
			alert("Your lastname is required");
			return false;
	}	
		if (document.contactus.Email.value == "" || (document.contactus.Email.value.indexOf("@",0) == -1||document.contactus.Email.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;
	}	
}
function WeeklyTip(){
		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.value == "" || (document.contactus.Email.value.indexOf("@",0) == -1||document.contactus.Email.value.indexOf(".",0) == -1)) { 
			alert("Please enter a valid E-mail address");
			return false;
	}
}



function RegForm(){
	
		if (document.Registration.Number.value == ""){
			alert("Please enter the number of attendees");
			return false;
	}
		if (document.Registration.attendees.value == ""){
			alert("Please enter the names of attendees");
			return false;
	}
	
	    if (document.Registration.Company.value == ""){
			alert("Please enter you company name");
			return false;
	}	

	   if (document.Registration.Mailing_Address.value == "" ) { 
			alert("Please provide you mailing address.");
			return false;
	}
		if (document.Registration.City.value == ""){
			alert("Please provide a city name");
			return false;
	}	
	
		if (document.Registration.Province.value == ""){
			alert("Please provide a province name");
			return false;
	}	
	    if (document.Registration.Postalcode.value == ""){
			alert("Please provide your postal code");
			return false;
	}	
	
		if (document.Registration.Email.value == "" || (document.Registration.Email.value.indexOf("@",0) == -1||document.Registration.Email.value.indexOf(".",0) == -1)) { 
			alert("Please enter a valid E-mail address");
			return false;
	}
	
}




function ReviewForm(){
	
	if (document.review.First_Name.value == ""){
			alert("Your firstname is required");
			return false;
	}	
	    if (document.review.Last_Name.value == ""){
			alert("Your lastname is required");
			return false;
	}	
		if (document.review.Email.value == "" || (document.review.Email.value.indexOf("@",0) == -1||document.review.Email.value.indexOf(".",0) == -1)) { 
			alert("Please enter a valid E-mail address");
			return false;
	}
	 if (document.review.PhoneNumber.value == ""){
			alert("Your Phone number is required");
			return false;
	}	
	
	  
		
	
}










function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		//loop through the images sent to the function to replace
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
		
		//Check to see if the file is a png and if it is rerun the png fix for ie6
		fileXT = getFileextension(document[changeImages.arguments[0]].src);
		if(fileXT==".png") fixPNG();
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		//button_background_over = newImage("/images/button-background-over.gif");
		nav_home_over = newImage("/images/nav_home_over.png");
		nav_about_over = newImage("/images/nav_aboutus_over.png");
		nav_services_over = newImage("/images/nav_services_over.png");
		nav_clients_over = newImage("/images/nav_clients_over.png");
		nav_blog_over = newImage("/images/nav_blog_over.png");
		nav_contact_over = newImage("/images/nav_contactus_over.png");
		preloadFlag = true;
	}
}

//Function to get the file extension
function getFileextension(filenm) {
	var filename = filenm;
	if( filename.length == 0 ) return "";
	var dot = filename.lastIndexOf(".");
	if( dot == -1 ) return "";
	var extension = filename.substr(dot,filename.length);
	return extension;
}

// 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 = "/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;
	}
}


//Change the tabs on the services landing page
function changeDescription(desc) {
	//Check to see if element exists
	if(document.getElementById(desc)){
		
		if(document.getElementsByName(desc)[1]){
			intVal = 1;
		} else {
			intVal = 0;
		}
		
		if(overObj!="Introduction"){
			//change current image to be regular state
			if ((version >= 5.5) && (version < 7) && (document.body.filters)){
				imgSRC = document.getElementsByName(overObj)[intVal].style.filter;
				imgSRC = imgSRC.replace("-over","");
				document.getElementsByName(overObj)[intVal].style.filter = imgSRC;
			} else {
				imgSRC = document.getElementsByName(overObj)[intVal].src;
				imgSRC = imgSRC.replace("-over","");
				changeImages(overObj, imgSRC);
			}
		}
		
		//change the selected image to over state
		if ((version >= 5.5) && (version < 7) && (document.body.filters)){
			imgSRC = document.getElementsByName(desc)[intVal].style.filter;
			imgSRC = imgSRC.replace(".png","-over.png");
			document.getElementsByName(desc)[intVal].style.filter = imgSRC;
		} else {
			imgSRC = document.getElementsByName(desc)[intVal].src;
			imgSRC = imgSRC.replace(".png","-over.png");
			changeImages(desc, imgSRC);
		}
		
		//Hide the current description text
		document.getElementById(overObj).style.display = "none";
		
		//Show the selected description text
		document.getElementById(desc).style.display = "inline";
		
		//Set the current over image
		overObj = desc;
	
		//fix the pngs for ie 6
		fixPNG();
	}
	return false;
}

// Track an event in google analytics and the Pathfinder
function trackpage(url){
	
	//Analytics page tracking call
	pageTracker._trackPageview(url);
	
	//Select information for Pathfinder Tracking
	switch (url) {
		case "Video/Closing_Sales":
			ajaxFunction("?vid=1")
			break;
		case "Video/Increasing_Lead_Flow":
			ajaxFunction("?vid=2")
			break;
		case "Video/Being_Number_1_on_Google":
			ajaxFunction("?vid=3")
			break;
		case "Video/Building_Your_Client_Database":
			ajaxFunction("?vid=4")
			break;
		case "Video/Your_Sales_Strategy":
			ajaxFunction("?vid=5")
			break;
		case "Video/Reaching_a_Global_Market":
			ajaxFunction("?vid=6")
			break;
		case "LatestRadioShow":
			ajaxFunction("?vid=7")
			break;
		default:
			ajaxFunction("?vid=0&pagevar="+url)
			break;
	}
}

// Show/Hide and position the definition bubbles
function showDef(objID,event){
	//Check to see if the element exists
	if(document.getElementById(objID)) {
		//get the object and set it to a variable
		obj = document.getElementById(objID);
		
		//hide or display the object
		obj.style.display = (obj.style.display=="block")?"none":"block";
		
		//position the object
		if(event.pageY || obj.pageY){
			obj.style.top = (event.pageY - obj.offsetHeight - 10);
			obj.style.left = (event.pageX - (obj.offsetWidth/2) + 80);
		} else {
			obj.style.top = (event.clientY - obj.offsetHeight - 10) + (document.documentElement.scrollTop ? document.documentElement.scrollTop:document.body.scrollTop);
			obj.style.left = (event.clientX - (obj.offsetWidth/2) + 80) + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft:document.body.scrollLeft);
		}
	}
}

function ajaxFunction(variables) {
	var xmlHttp;
	try {  // Firefox, Opera 8.0+, Safari 
		xmlHttp=new XMLHttpRequest();
	} catch (e) {  // Internet Explorer 
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
			//document.myForm.time.value = xmlHttp.responseText;
		}
	}
	xmlHttp.open("GET","/flashTrack.asp"+variables,true);
	xmlHttp.send(null);
}