// JavaScript Document
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_preswapImage() { //v3.0
  var i,j=0,x,a=MM_preswapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; x.src=a[i+2];}
}
function Isempty(strvalue)
{
	if(strvalue== "")
	{
		return false;
	}
	return true;
}

function submitIt(form1) {
	if (!Isempty(form1.Name.value))
	{
		alert("Please enter your name!");
		form1.Name.focus();
		form1.Name.select();
		return false;
	}
	if (!Isempty(form1.Title.value))
	{
		alert("Please enter your title!");
		form1.Title.focus();
		form1.Title.select();
		return false;
	}
	if (!Isempty(form1.Organization.value))
	{
		alert("Please enter your organization's name!");
		form1.Organization.focus();
		form1.Organization.select();
		return false;
	}
	if (!Isempty(form1.Phone.value))
	{
		alert("Please enter your phone number!");
		form1.Phone.focus();
		form1.Phone.select();
		return false;
	}
	if (!Isempty(form1.Fax.value))
	{
		alert("Please enter your fax number!");
		form1.Fax.focus();
		form1.Fax.select();
		return false;
	}
	if (!Isempty(form1.Email.value))
	{
		alert("Please enter your email address!");
		form1.Email.focus();
		form1.Email.select();
		return false;
	}
	var VEnter = form1.VEnter.value;
	if (!Isempty(VEnter))
	{
		alert("Please enter the validation code!");
		form1.VEnter.focus();
		form1.VEnter.select();
		return false;
	}
	if (VEnter.length < 4)
	{
		alert("The code is invalid! Please re-enter it.");
		form1.VEnter.focus();
		form1.VEnter.select();
		return false;
	}
	return true;
}
var thisbtn = null;
var thisnav = null;
function navSwitch(navid, onoff){
	if(onoff){
		thisbtn = document.getElementById("btn_" + navid);
		thisnav = document.getElementById("nav_" + navid);
		prevbtnclass = thisbtn.className;
		prevnavclass = thisnav.className;
		thisbtn.className = "leftnav_on";
		if(thisnav.className == "leftnav_link"){
			thisnav.className = "leftnav_link_on";
		}else{
			//thisnav.className = "leftnavsub_link_on";
		}
	}else{
		thisbtn.className = prevbtnclass;
		thisnav.className = prevnavclass;
	}
}

var thistopbtn = null;
var thistopnav = null;
function topnavSwitch(navid, onoff){
	if(onoff){
		thistopbtn = document.getElementById("topbtn_" + navid);
		//thistopnav = document.getElementById("topnav_" + navid);
		prevtopbtnclass = thistopbtn.className;
		//prevtopnavclass = thistopnav.className;
		thistopbtn.className = "topbtn_on_" + navid;
		//thistopnav.className = "topnav_link_on";
	}else{
		thistopbtn.className = prevtopbtnclass;
		//thistopnav.className = prevtopnavclass;
	}
}
function moveCities(){
	var obj = document.getElementById("imgmap");
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	//order is: Kingston, Oshawa, Barrie, Kitchener, Hamilton, Niagara, London, Windsor
	var cityleft = new Array(326, 278, 197, 191, 224, 250, 190, 155, 126);
	var citytop  = new Array(132, 153, 167, 199, 213, 220, 234, 234, 294);
	//var triangletop  = 183;
	var triangleleft = new Array(335, 287, 206, 200, 233, 259, 199, 164, 134);
	var triangletop = new Array(137, 157, 160, 160, 158, 158, 158, 158, 158);
	for(i=0; i<cityleft.length; i++){
		document.getElementById("City_" + i).style.left = (curleft + cityleft[i]) + 'px';
		document.getElementById("City_" + i).style.top = (curtop + citytop[i]) + 'px';
		document.getElementById("Triangle_" + i).style.left = (curleft + triangleleft[i]) + 'px';
		document.getElementById("Triangle_" + i).style.top = (curtop + triangletop[i]) + 'px';
	}
	document.getElementById("Info_main").style.left = (curleft + 357) + 'px';
	document.getElementById("Info_main").style.top = (curtop + 160) + 'px';
}
function cityPopup(cid){
	//document.getElementById("City_" + cid).style.backgroundImage = "url('images/map_rollover_circle.png')";
	document.getElementById("City_" + cid).className = "bullet-city-ro";
	document.getElementById("Triangle_" + cid).style.display = 'block';
	document.getElementById("Info_" + cid).style.display = 'block';
	document.getElementById("Info_main").style.display = 'block';
}
function cityHide(cid){
	//document.getElementById("City_" + cid).style.backgroundImage = "none";
	document.getElementById("City_" + cid).className = "bullet-city";
	document.getElementById("Triangle_" + cid).style.display = 'none';
	document.getElementById("Info_" + cid).style.display = 'none';
	document.getElementById("Info_main").style.display = 'none';
}
var Selectedcity = "Selectcity";
function showContractors(){
	objSelect = document.getElementById("City");
	sel_Index = objSelect.selectedIndex;
	sel_Option = objSelect.options[sel_Index].value;
	document.getElementById(Selectedcity).style.display = 'none';
	document.getElementById(sel_Option).style.display = 'block';
	Selectedcity = sel_Option;
}

function showDiv(divID){
	//alert("The divID is " + divID);
	for(i=1; i<=3; i++){
	//	don = i == divID ? "display" : "none"
		if(i == divID){
			document.getElementById("df" + i).style.display = "block";
		}else{
			document.getElementById("df" + i).style.display = "none";
		}
	}
}

	
	
