var whatSelected

function showDiv(whatDiv){
	document.getElementById(whatDiv).style.display='block';
}

function hideDiv(whatDiv){
	document.getElementById(whatDiv).style.display='none';
}

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_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_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];}
}
//onmouseover="MM_swapImage('imgFloorPlanning','','images/sub_floor_over.gif',1)" onmouseout="MM_swapImgRestore()"

function getCookie(c_name){
	if (document.cookie.length>0){
		c_start=document.cookie.indexOf(c_name + "=");
		if(c_start!=-1){ 
			c_start=c_start + c_name.length+1 ;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1){c_end=document.cookie.length;}
			return unescape(document.cookie.substring(c_start,c_end));
		} 
	}
	return null;
}
function setCookie(c_name,value,expiredays){
	var exdate=new Date();
	exdate.setDate(expiredays);
	document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate);
}

function advancedCookieCutter(){
	whichDiv=getCookie('advShowDiv');
	if(getCookie('advShowDiv')==null){
		setCookie('advShowDiv', 'floorPlanning', 1000);
		document.getElementById('floorPlanning').style.display='block';
		whatSelected='floorPlanning';
	}else{
		document.getElementById(whichDiv).style.display='block';
		whatSelected='whichDiv';
	}
	imgReset();
}
function emailer(){
	str="mailto:";
	str=str+"sales@";
	str=str+"bramic.";
	str=str+"net";
	location.href = str;
}
function emailSales(){
	str="mailto:";
	str=str+"sales@";
	str=str+"bramic.";
	str=str+"net";
	location.href = str;
}

function normImgs(){
	MM_swapImage('imgFloorPlanning','','images/sub_floor.gif',1);
	MM_swapImage('imgBudgeting','','images/sub_budgeting.gif',1);
	MM_swapImage('imgPowerDataLighting','','images/sub_power.gif',1);
	MM_swapImage('imgHealthSafety','','images/sub_health.gif',1);
	MM_swapImage('imgLogisticsHandling','','images/sub_logistics.gif',1);
	MM_swapImage('imgInstallation','','images/sub_installation.gif',1);
	MM_swapImage('imgErgonomicTraining','','images/sub_ergo.gif',1);
	MM_swapImage('imgWarrranty','','images/sub_warranty.gif',1);
	//MM_swapImage('imgCoreValues','','images/sub_core.gif',1);
}

function overHandler(varIn){
	//alert('VAR IN: '+varIn);
	curr=getCookie('advShowDiv');
	if(curr==null){
		curr=whatSelected;
	}

	normImgs();
	document.getElementById('floorPlanning').style.display='none';
	document.getElementById('budgeting').style.display='none';
	document.getElementById('powerDataLighting').style.display='none';
	document.getElementById('healthSafety').style.display='none';
	document.getElementById('logisticsHandling').style.display='none';
	document.getElementById('installation').style.display='none';
	//document.getElementById('ergonomicTraining').style.display='none';
	document.getElementById('warrranty').style.display='none';
	//document.getElementById('coreValues').style.display='none';
	document.getElementById(varIn).style.display='block';
	if(varIn=='floorPlanning'){
		MM_swapImage('imgFloorPlanning','','images/sub_floor_over.gif',1);
	}else if(varIn=='budgeting'){
		MM_swapImage('imgBudgeting','','images/sub_budgeting_over.gif',1);
	}else if(varIn=='powerDataLighting'){
		MM_swapImage('imgPowerDataLighting','','images/sub_power_over.gif',1);
	}else if(varIn=='healthSafety'){
		MM_swapImage('imgHealthSafety','','images/sub_health_over.gif',1);
	}else if(varIn=='logisticsHandling'){
		MM_swapImage('imgLogisticsHandling','','images/sub_logistics_over.gif',1);
	}else if(varIn=='installation'){
		MM_swapImage('imgInstallation','','images/sub_installation_over.gif',1);
	}else if(varIn=='ergonomicTraining'){
		MM_swapImage('imgErgonomicTraining','','images/sub_ergo_over.gif',1);
	}else if(varIn=='warrranty'){
		MM_swapImage('imgWarrranty','','images/sub_warranty_over.gif',1);
	}else if(varIn=='coreValues'){
		//MM_swapImage('imgCoreValues','','images/sub_core_over.gif',1);
	}
}

function imgReset(){
	curr=getCookie('advShowDiv');
	if(curr==null){
		curr=whatSelected;
	}
	normImgs();

	if(curr=='floorPlanning'){
		MM_swapImage('imgFloorPlanning','','images/sub_floor_over.gif',1);
	}else if(curr=='budgeting'){
		MM_swapImage('imgBudgeting','','images/sub_budgeting_over.gif',1);
	}else if(curr=='powerDataLighting'){
		MM_swapImage('imgPowerDataLighting','','images/sub_power_over.gif',1);
	}else if(curr=='healthSafety'){
		MM_swapImage('imgHealthSafety','','images/sub_health_over.gif',1);
	}else if(curr=='logisticsHandling'){
		MM_swapImage('imgLogisticsHandling','','images/sub_logistics_over.gif',1);
	}else if(curr=='installation'){
		MM_swapImage('imgInstallation','','images/sub_installation_over.gif',1);
	}else if(curr=='ergonomicTraining'){
		MM_swapImage('imgErgonomicTraining','','images/sub_ergo_over.gif',1);
	}else if(curr=='warrranty'){
		MM_swapImage('imgWarrranty','','images/sub_warranty_over.gif',1);
	}else if(curr=='coreValues'){
		//MM_swapImage('imgCoreValues','','images/sub_core_over.gif',1);
	}

	document.getElementById('floorPlanning').style.display='none';
	document.getElementById('budgeting').style.display='none';
	document.getElementById('powerDataLighting').style.display='none';
	document.getElementById('healthSafety').style.display='none';
	document.getElementById('logisticsHandling').style.display='none';
	document.getElementById('installation').style.display='none';
	//document.getElementById('ergonomicTraining').style.display='none';
	document.getElementById('warrranty').style.display='none';
	//document.getElementById('coreValues').style.display='none';

	document.getElementById(curr).style.display='block';
}

function outHandler(varIn){
	curr=getCookie('advShowDiv');
	if(curr==null){
		curr=whatSelected;
	}

	if(varIn=='floorPlanning' && !(varIn==curr)){
		MM_swapImage('imgFloorPlanning','','images/sub_floor.gif',1);
	}else if(varIn=='budgeting' && !(varIn==curr)){
		MM_swapImage('imgBudgeting','','images/sub_budgeting.gif',1);
	}else if(varIn=='powerDataLighting' && !(varIn==curr)){
		MM_swapImage('imgPowerDataLighting','','images/sub_power.gif',1);
	}else if(varIn=='healthSafety' && !(varIn==curr)){
		MM_swapImage('imgHealthSafety','','images/sub_health.gif',1);
	}else if(varIn=='logisticsHandling' && !(varIn==curr)){
		MM_swapImage('imgLogisticsHandling','','images/sub_logistics.gif',1);
	}else if(varIn=='installation' && !(varIn==curr)){
		MM_swapImage('imgInstallation','','images/sub_installation.gif',1);
	}else if(varIn=='ergonomicTraining' && !(varIn==curr)){
		MM_swapImage('imgErgonomicTraining','','images/sub_ergo.gif',1);
	}else if(varIn=='warrranty' && !(varIn==curr)){
		MM_swapImage('imgWarrranty','','images/sub_warranty.gif',1);
	}else if(varIn=='coreValues' && !(varIn==curr)){
		//MM_swapImage('imgCoreValues','','images/sub_core.gif',1);
	}
	//imgReset();
}

function clickHandler(varIn){
	document.getElementById(varIn).style.display='block';
	setCookie('advShowDiv', varIn, 1000);
	whatSelected=varIn;

	imgReset();
	overHandler(varIn);
}

function bigImgReset(){
	if(navigator.appName=="Netscape"){
		imgReset();
	}
}

function showAll(){
	document.getElementById('floorPlanning').style.display='block';
	document.getElementById('budgeting').style.display='block';
	document.getElementById('powerDataLighting').style.display='block';
	document.getElementById('healthSafety').style.display='block';
	document.getElementById('logisticsHandling').style.display='block';
	document.getElementById('installation').style.display='block';
	//document.getElementById('ergonomicTraining').style.display='block';
	document.getElementById('warrranty').style.display='block';
	//document.getElementById('coreValues').style.display='block';
}
//onbeforeprint="showAll();" "onbeforeprint="imgReset();"


//FOR LIGHTBOX
function showGallery(galleryIn){
	document.getElementById('nav').style.display="none";
	new Effect.Appear(galleryIn, { duration: 0.2, from: 0.0, to: 1 });
	//new Effect.SlideDown(galleryIn);
	var arrayPageSize = getPageSize();
	Element.setHeight('bdGalleryBack', arrayPageSize[1]);
	new Effect.Appear('bdGalleryBack', { duration: 0.2, from: 0.0, to: 0.6 });
}
function closeGallery(galleryIn){
	document.getElementById('nav').style.display="block";
	new Effect.Fade(galleryIn, { duration: 0.2});
	new Effect.Fade('bdGalleryBack', { duration: 0.2});
}

//new
function playVideo(){
	popwin = this.open("video.html", "video", "width=400,height=317,toolbar=no,menubar=no,location=no,resize=no,noresize");
	popwin.focus();
}
function indexChanger(text){
	window.document.nav.SetVariable("jsChanger", text);
}