preloadflag = true;

// Browser Detection
var V = navigator.appVersion.substring(0,1);
var brsr = 0;
if (V < 4) {
	top.alert("This site uses java to support its major navigation.\n You may have trouble viewing the site");
} else if (navigator.appName.indexOf("Netscape") > -1) {

} else if (navigator.appName.indexOf("Explorer") > -1) {
		var T = navigator.appVersion.indexOf("MSIE");
		T += 5;
		V = navigator.appVersion.substring(T,eval(T+1));
}
if (navigator.appName.indexOf("Netscape") > -1) {
	brsr = 1;
} else if (navigator.appName.indexOf("Explorer") > -1) {
	if (V < 5) {

	} else {
		brsr = 2;
	}
}


function showClientLogin() {

	page = 'http://www.etraker3.com/kanban/';

	w = 800;
	h = 550;

	var width
	var height
	var leftdist
	var topdist

	width = screen.width;
	height = screen.height;
	leftdist = Math.round((width - w) / 2);
	topdist = Math.round((height - h) / 2);

	args = 'resizable=1,menubar=0,location=1,scrollbars=1,status=1,toolbar=1';

	clientLoginWin = window.open(page,'clientLoginWin','width='+ w +',height='+ h +',top='+topdist+',left='+leftdist+','+ args);
	clientLoginWin.focus();
}


function switchSubNav (id,state) {
	if (state) {
		changeImages('','sN_'+ id,'sNav_'+ id +'On')
	} else {
		changeImages('','sN_'+ id,'sNav_'+ id +'Off')
	}
}


function switchSubBtnNav (id,state) {
	if (state) {
		changeImages('','sBN_'+ id,'sBtnNav_'+ id +'On')
	} else {
		changeImages('','sBN_'+ id,'sBtnNav_'+ id +'Off')
	}
}



// usage : writing out link
// <script>linkMail('hostdomain','username');</script>
// usage : link only
// <a href="javascript:popMail('hostdomain','username')">email us</a>
// usage : showing an email address
// <script>showMail('hostdomain','username');</script>

function popMail(host,user) {
	var acct = user +'@'+ host;
	self.location.href = 'mailto:'+ acct;
}
function linkMail(host,user,cls) {
	document.write('<a href="javascript:popMail(\''+ host +'\',\''+ user +'\');"');
	if (cls) {
		document.write(' class="'+ cls +'"');
	}
	document.write('>');
	showMail(host,user);
	document.write('</a>');
}
function showMail(host,user) {
	var acct = user +'@'+ host;
	document.write(acct);
}



function centerPop(page,w,h,args){
	if (w > 0) {
	} else {
		w = 650
	}
	if (h > 0) {
	} else {
		h = 550
	}
	var width
	var height
	var leftdist
	var topdist
	width = screen.width;
	height = screen.height;
	leftdist = Math.round((width - w) / 2);
	topdist = Math.round((height - h) / 2);
	if (args = '') {
		args = 'resizable=1,menubar=0,location=0,scrollbars=1,status=1,toolbar=0';
	}
	cpw = window.open(page,'cpw','width='+ w +',height='+ h +',top='+topdist+',left='+leftdist+','+ args);
	cpw.focus();
}


function centerPopMenu(page,w,h){

if (w > 0) {
} else {
 w = 650
}
if (h > 0) {
} else {
 h = 550
}

var width
var height
var leftdist
var topdist
width = screen.width;
height = screen.height;
leftdist = Math.round((width - w) / 2);
topdist = Math.round((height - h) / 2);

gwin = window.open(page,'gwin','width='+ w +',height='+ h +',top='+topdist+',left='+leftdist+',resizable=1,menubar=1,location=0,scrollbars=1,status=1,toolbar=0');
gwin.focus();

}


	function PopWin(HEIGHT,WIDTH,URL) {
		var PopWin = window.open(URL,'PopWin',"width="+ WIDTH +",height="+ HEIGHT +",scrollbars=0,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
		PopWin.focus()
	}

	function newImage(arg) {
		if (document.images) {
			rslt = new Image();
			rslt.src = arg;
			return rslt;
		}

		//img_on	= newImage("/pics/index_nav/index_con.gif");
		//img_off	= newImage("/pics/index_nav/index_con.gif");
	}

	function resWin(page) {
		var resWin = window.open(page,'resWIn',"width=499,height=333,scrollbars=0,toolbar=1,location=0,directories=0,status=1,menubar=0,resizable=1");
		resWin.open
	}

	function changeImages() {
	//	if (document.images && (preloadFlag == true)) {
			for (var i=0; i<changeImages.arguments.length; i+=3) {
			//  top.alert (document.layers[i].document[changeImages.arguments[i+1]].name)
			//document.layers[changeImages.arguments[i]].document[changeImages.arguments[i+1]].src = eval(changeImages.arguments[i+2]+".src");
				if (brsr == 1) {
			//		if (changeImages.arguments[i] != '') {
			//			document[changeImages.arguments[i+1]].src = eval(changeImages.arguments[i+2]+".src")
			//		} else {
						if (document[changeImages.arguments[i+1]]) document[changeImages.arguments[i+1]].src = eval(changeImages.arguments[i+2]+".src")
			//		}
				}
				if (brsr == 2) {
					if (document[changeImages.arguments[i+1]]) document[changeImages.arguments[i+1]].src = eval(changeImages.arguments[i+2]+".src")
				}
			}
	//	}
	}
	function changeImagesStr() {
			for (var i=0; i<changeImagesStr.arguments.length; i+=3) {
				if (brsr == 1) {
						document[changeImagesStr.arguments[i+1]].src = changeImagesStr.arguments[i+2]
				}
				if (brsr == 2) {
					document[changeImagesStr.arguments[i+1]].src = changeImagesStr.arguments[i+2]
				}
			}
	}

	function rollOver (item,state) {
		if (state) {
			changeImages('','i'+item,'i'+item+'_on');
		} else {
			changeImages('','i'+item,'i'+item+'_off');
		}
	}

	function setClass() {
		var args=setClass.arguments;
		var ston = 0;

		if (brsr != 0) {
			for (i = ston; i<(args.length-1); i+=2) {
				var obj = args[i];
				var cls = args[i+1];
				if (brsr == 1 && V >= 5) {
					document.getElementById(obj).className = cls;
				}
				if (brsr == 2) {
					if (document.all[obj]) {
						document.all[obj].className = cls;
					}
				}
			}
		}
	}

	function showHideLayers() {
		var args=showHideLayers.arguments;
		var ston = 1;
		var baser = args[0];

		if (brsr != 0) {
			for (i = ston; i<(args.length-1); i+=2) {
				var obj = args[i];
				var vis = args[i+1];
				if (brsr == 1 && V < 5) {
						if (document.layers[obj]) document.layers[obj].visibility = vis;
				}
				if (brsr == 1 && V >= 5) {
					if (document.getElementById(obj)) {
						document.getElementById(obj).style.visibility = vis;
					}
				}
				if (brsr == 2) {
					if (document.all[obj]) {
						document.all[obj].style.visibility = vis;
					}
				}
			}
		}
	}



	function delayHide() {
			if (t==0) {
					removeall();
					lCount = 0;
			}
			if (t==2) {
					lCount = 0;
			}
			if (t==1) {
					lCount = lCount + 1;
					if (lDelay <= lCount) {
							t = 0;
					}
					if (lDelay >= lCount) {
							setTimeout('delayHide(' + t + ')',pause);
					}
			}
			return false;
	}



function MM_findObj(n, d) { //v3.0
  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); return x;
}
/* Functions that swaps images. */
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_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;
}

/* Functions that handle preload. */
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 imageSwap(id,path)
{
	$(id).src = path;
}

function launchVideoModal(id)
{
//id = 19454
	display_modal('<div id="videoSpot"></div>');
	var FO = { movie:"http://www.circumerrovideo.com/v/c/projectid=19454&programid=" + id,
			   width:"510",
			   height:"330",
			   majorversion:"8",
			   build:"0",
			   wmode:"transparent",
			   bgcolor: "none",
			   quality: "high",
			   allowFullScreen: "true",
			   align: "middle" };
	UFO.create(	FO, "videoSpot");
}

var close_modal = '<div id="close_modal"><a href="javascript:clear_modal()">Close</a></div>';

function display_modal(content)
{
	page_dims = getPageSizeWithScroll();
	var height = page_dims[1] + 300;
	//alert(height+'px');
	page_pos = getPagePosition();
	document.getElementById('blackOut').style.display = 'inline';
	document.getElementById('blackOut').style.height = height+'px';
	document.getElementById('OuterContainer').style.display = 'inline';
	document.getElementById('InnerContainer').innerHTML = content + close_modal;
}

function clear_modal()
{
	document.getElementById('blackOut').style.display = 'none';
	document.getElementById('OuterContainer').style.display = 'none';
	document.getElementById('InnerContainer').innerHTML = '';
	document.getElementById('InnerContainer').style.width = '600px';
}

function getPageSizeWithScroll()
{
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY + 100;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	return arrayPageSizeWithScroll;
}

function getPagePosition ()
{
  var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	return [ scrOfX, scrOfY ];
}


// -->
