// JavaScript Document

var isAll=(document.all) ? true : false;
var isLay=(document.layers) ? true : false;
var isbyId=(document.getElementById && !document.all) ? true : false;
var popped_up = 0;
opaque('layer1');

// Start of Creative Lynx Limited functions

function opaque(layer_id){
	layer_id.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=100)";
}

function transparent(layer_id){
	layer_id.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=30)";
}

function ref_hide(ref){
	setVisibility(ref,0);
	setDisplay(ref,0);
	return false;
}

function ref_show(ref){
	if(popped_up == 0){
		setVisibility(ref,1);
		setDisplay(ref,1);
		return false;
	}
}

function sub_ref_show(ref){
	setVisibility(ref,1);
	setDisplay(ref,1);
	return false;
}
	
function popup_hide(ref){
	popped_up = 0;
	opaque(Layer1);
	popup_hide_all();
	setVisibility(ref,0);
	setDisplay(ref,0);
	setDisplay("closebutton",0);
	setVisibility("closebutton",0);
	return false;
}

function popup_show(ref){
	popup_hide_all();
	popped_up = 1;
	transparent(Layer1);
	setVisibility(ref,1);
	setDisplay(ref,1);
	setDisplay("closebutton",1);
	setVisibility("closebutton",1);
	return false;
}

function popup_hide_all(){
 	var i=1;
	while (i<=9) {
		var popup=document.getElementById("popup"+i);
		setVisibility(popup,0);
		setDisplay(popup,0);
		i++;
	}
			
	var i=1;
	while (i<=9) {
		var ref=document.getElementById("ref"+i);
		setVisibility(ref,0);
		setDisplay(ref,0);
		i++;
	}
					
	opaque(Layer1);
	ref_hide("closebutton");				
	popped_up = 0;
}

// end of Creative Lynx Limited functions

function returnDomElement(ref){
	if(ref && isObject(ref)){
		return ref;
	}else{
		if(isbyId){
			if(document.getElementById([ref])){
				return document.getElementById([ref]);
			}else{
				return false;
			}
			
		}else if(isLay){
			if(document.layers[ref]){
				return document.layers[ref];
			}else{
				return false;
			}
		}else if(isAll){
			if(document.all[ref]){
				return document.all[ref];
			}else{
				return false;
			}
		}
	}
}

function isObject(a){
    return (a && typeof a=='object') || isFunction(a);
}

function isFunction(a){
    return typeof a=='function';
}

function setVisibility(ref,bSwitch){
	var oLayerRef=returnDomElement(ref);

	if(isAll && oLayerRef){
		if(bSwitch == 1){
			sVisibility='visible';
		}else{
			sVisibility='hidden';
		}
		oLayerRef.style.visibility=sVisibility;
	}
	if(isLay && oLayerRef){
		if(bSwitch == 1){
			sVisibility='show';
		}else{
			sVisibility='hide';
		}
		oLayerRef.visibility=sVisibility;
	}
	if(isbyId && oLayerRef){
		if(bSwitch == 1){
			sVisibility='visible';
		}else{
			sVisibility='hidden';
		}
		oLayerRef.style.visibility=sVisibility;
	}
}


function setDisplay(ref,bSwitch){
	var oLayerRef=returnDomElement(ref);

	if(isAll && oLayerRef){
		if(bSwitch == 1){
			sDisplay='block';
		}else{
			sDisplay='none';
		}
		oLayerRef.style.display=sDisplay;
	}
	if(isLay && oLayerRef){
		if(bSwitch == 1){
			sDisplay='block';
		}else{
			sDisplay='none';
		}
		oLayerRef.display=sDisplay;
	}
	if(isbyId && oLayerRef){
		if(bSwitch == 1){
			sDisplay='block';
		}else{
			sDisplay='none';
		}
		oLayerRef.style.display=sDisplay;
	}
}



// DreamWeaver swap image functions

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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 swapImage(ref,sSrc){
	var oLayerRef=document.getElementById([ref]);
	if(oLayerRef){
		oLayerRef.src=sSrc;
	}
	return false;
}

