//document.onClick = resizeMac;
function ids_pop(URL,facename,w,h,scroll){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
var speed = 10;
settings='height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',toolbar=no,location=no,status=no,menubar=no,resizable=no,dependent=no';
win=window.open(URL,facename,settings);
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
var oldpos = 0;
var dir = 0;
var images = new Array();
images[0] = "images/bj_01.jpg";
images[1] = "images/bj_02.jpg";
images[2] = "images/bj_03.jpg";
images[3] = "images/bj_04.jpg";
images[4] = "images/bj_05.jpg";
images[5] = "images/bj_06.jpg";

function getRandom(start,end) 
{ 
	var range = end - start; 
	var result = start + Math.floor(Math.random()*range); 
	return result; 
}

function getRandomImage() {
	document.homeImage.src = images[getRandom(0, images.length)];
}
function resizeMac() {
// resize blank placeholder div so IE 5
// on mac will get all clicks in window
if ((navigator.appVersion.indexOf('MSIE 5') != -1) && (navigator.platform.indexOf('Mac') != -1)) {
  	window.location.reload(); 
// 	resizeWindow('subnav01',178);
//	resizeWindow('subnav02',262);
//	resizeWindow('subnav03',250);
//	resizeWindow('subnav04',287);
//	resizeWindow2();
  }
}
function resizeWindow(layerName, lmargin) {
	if (document.layers) {
		var bodyWidth = window.innerWidth;
		if (bodyWidth < 770) {
			document.layers[layerName].left = lmargin;
		} else {
			document.layers[layerName].left = (bodyWidth - 770)/2 + lmargin;
		}
	} else if (document.getElementById) {
		var bodyWidth = document.body.offsetWidth;
		if (bodyWidth < 770) {
			document.getElementById(layerName).style.left = lmargin;
		} else {
			document.getElementById(layerName).style.left = (bodyWidth - 770)/2 + lmargin;
		}
	} else if (document.all) {
		var bodyWidth = document.body.offsetWidth;
		if (bodyWidth < 770) {
			document.all[layerName].style.left = lmargin;
		} else {
			document.all[layerName].style.left = (bodyWidth - 770)/2 + lmargin;
		}
    }
}
function resizeWindow2() {
	lmargin = 158 - (oldpos * 406);
	if (document.layers) {
		var bodyWidth = window.innerWidth;
		var oldleft = document.contentLayer.left;
		if (bodyWidth < 770) {
			document.contentLayer.left = lmargin;
		} else {
			document.contentLayer.left = (bodyWidth - 770)/2 + lmargin;
		}
	} else if (document.getElementById) {
		var bodyWidth = document.body.offsetWidth;
		if (bodyWidth < 770) {
			document.getElementById('contentLayer').style.left = lmargin;
		} else {
			document.getElementById('contentLayer').style.left = (bodyWidth - 770)/2 + lmargin;
		}
	} else if (document.all) {
		var bodyWidth = document.body.offsetWidth;
		if (bodyWidth < 770) {
			document.contentLayer.style.left = lmargin;
		} else {
			document.contentLayer.style.left = (bodyWidth - 770)/2 + lmargin;
		}
    }
}
function jumpTo(x_pos) {
	if (document.layers) {
		var page = eval(document.contentLayer);
		var lmargin = (window.innerWidth - 770)/2;
	} else if (document.getElementById) {
		var page= eval("document.getElementById('contentLayer').style");
		var lmargin = (document.body.offsetWidth - 770) /2;
	} else if (document.all) {
		var page = eval(document.all.contentLayer.style);
		var lmargin = (document.body.offsetWidth - 770) /2;
	}
	if (lmargin < 0) {
		lmargin = 0;
	}
	oldpos = x_pos;
	page.left = lmargin + 158 - (x_pos * 406);
}
function horzScroll(dir, spd, loop) {
	if (document.layers) {
		var page = eval(document.contentLayer);
		var lmargin = (window.innerWidth - 770)/2;
	} else if (document.getElementById) {
		var page= eval("document.getElementById('contentLayer').style");
		var lmargin = (document.body.offsetWidth - 770) /2;
	} else if (document.all) {
		var page = eval(document.all.contentLayer.style);
		var lmargin = (document.body.offsetWidth - 770) /2;
	}
	loop = true;
	direction = "lft";
	speed = 7;
	scrolltimer = null;
	direction = dir;
	speed = parseInt(spd);
	var x_pos = parseInt(page.left);
	var llimit = 152 + lmargin;
	var rlimit = 165 + lmargin - (5 * 406);
	if (loop == true) {
		if (direction == "rgt" && x_pos > rlimit) {
			page.left = (x_pos - (speed));
		} else if (direction == "lft" && x_pos < llimit) {
			page.left = (x_pos + (speed));
		}
	}
	scrolltimer = setTimeout("horzScroll(direction,speed)", 1);
}
function stopScroll() {
	loop = false;
	clearTimeout(scrolltimer);
}
function toggleVisibility(layerName, visibility) {
	if (document.all) {
		document.all[layerName].style.visibility = visibility;
	}
	else if (document.getElementById) {
		document.getElementById(layerName).style.visibility = visibility;
	}
	else if (document.layers) {
		document.layers[layerName].visibility = visibility;
	}
	else {
	
	}

}
function closeAllLayers() {
	var layerName;
	for (var i=1; i<6; i++) {
		layerName = "subnav" + i;
		if (layerExist(layerName))
			toggleVisibility(layerName, "visibility");
	}
}

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.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);
  if(!x && document.getElementById) x=document.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];}
}