// JavaScript Document
<!--

// ---------- DISABLE IMAGE CONTEXT MENU ----------
function clickIE() {
        if (document.all) {
                return false;
        }
 }

function clickNS(e) {
        if (document.layers||(document.getElementById&&!document.all)) {
                if (e.which==2||e.which==3) {
                        return false;
                }
        }
 }
if (document.layers) {
	document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS; }
	else {
	document.onmouseup=clickNS;document.oncontextmenu=clickIE;
}
document.oncontextmenu=new Function("return false")
// ---------- DISABLE IMAGE CONTEXT MENU ----------

// ---------- POPUP WINDOW ----------
var win=null;
function NewWindow(mypage,myname,w,h,pos,infocus){
if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}
settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";win=window.open(mypage,myname,settings);
win.focus();}
// ---------- POPUP WINDOW ----------

// ---------- IDLanguage cookie ----------
var expDays = 30;
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function getCookieVal (offset) {  
var endstr = document.cookie.indexOf (";", offset);  
if (endstr == -1)   { 
endstr = document.cookie.length;  }
return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {  
var arg = name + "=";  
var alen = arg.length;  
var clen = document.cookie.length;  
var i = 0;  
while (i < clen) {    
var j = i + alen;    
if (document.cookie.substring(i, j) == arg)      
return getCookieVal (j);    
i = document.cookie.indexOf(" ", i) + 1;    
if (i == 0) 
break;   
}  
return null;
}

function SetCookie (name, value, expires, path, domain) {  
var argv = SetCookie.arguments;  
var argc = SetCookie.arguments.length;  
var expires = (argc > 2) ? argv[2] : null;  
var path = (argc > 3) ? argv[3] : null;  
var domain = (argc > 4) ? argv[4] : null;  
var secure = (argc > 5) ? argv[5] : false;  
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) +  
((domain == null) ? "" : ("; domain=" + domain)) +    
((secure == true) ? "; secure" : "");
}

function DeleteCookie (name) {  
var exp = new Date();  
exp.setTime (exp.getTime() - 1);  
var cval = GetCookie (name);  
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
// ---------- IDLanguage cookie ----------

// ---------- global browser function ----------
var nn4 = (document.layers) ? true : false
var ie = (document.all) ? true : false
var dom = (document.getElementById && !document.all) ? true : false
var moz = (window.sidebar) ? true : false

function browser(id){
  if(nn4){
  path = document.layers[id]
  }else if(ie){
  path = document.all[id]
  }else{
  path = document.getElementById(id)
  }
return path
}
// ---------- global browser function ----------

// ---------- Fading LAYERS ----------
function show(id){
var layer = browser(id)	// get layer path from global browser function

      if(nn4){ 
      layer.display = '';
      }else{
      layer.style.display = '';
      }
}

function hide(id){
var layer = browser(id)	// get layer path from global browser function

      if(nn4){ 
      layer.display = 'none';
      }else{
      layer.style.display = 'none';
      }
	  value=0;
}

value=0

function fadeIn(id){
var layer = browser(id)	// get layer path from global browser function
var TransparencyLevel = 100 //set the end of fade opacity
var FadeTime = 5 //set the fade duration

	if(value < TransparencyLevel){
		value+=FadeTime
		MozValue = value/100;
		
		if (ie){
			layer.filters[0].opacity = value;
		}else if (moz){
			layer.style.MozOpacity = MozValue;
		}else{
			layer.style.opacity = MozValue;
		}
		setTimeout("fadeIn('" + id + "'," + value + ")",10)
	}
}
// ---------- Fading LAYERS ----------

// ---------- Sliding LAYERS ----------
function slide(id,inity,y){
var layer = browser(id)	// get layer path from global browser function
var currPos = (nn4) ? layer.top : parseInt(layer.style.top) 

	if(currPos == (inity) && currPos < y){ // create initial position (heigth = y + x)
	setTimeout("slideDown('" + id + "'," + y + ")",200)
	}	
	if(currPos == (inity) && currPos > y){
	setTimeout("slideUp('" + id + "'," + y + ")",200)
	}	
}

function slideDown(id,y){
var layer = browser(id)	// get layer path from global browser function
var currPos = (nn4) ? layer.top : parseInt(layer.style.top) 

	if(currPos < y){
	//currPos += 10 // move
	currPos += Math.round((y-currPos)/10)+1; // moveout
	
		if(nn4){	
		layer.top = currPos	
		}else{
		layer.style.top = currPos
		}
	
	setTimeout("slideDown('" + id + "'," + y + ")",10)
	}	
}

function slideUp(id,y){
var layer = browser(id)	// get layer path from global browser function
var currPos = (nn4) ? layer.top : parseInt(layer.style.top) 

	if(currPos > y){
	//currPos -= 10 // move
	currPos += Math.round((y-currPos)/10)-1; // moveout
	
		if(nn4){	
		layer.top = currPos	
		}else{
		layer.style.top = currPos
		}
	
	setTimeout("slideUp('" + id + "'," + y + ")",10)
	}	
}
// ---------- Sliding LAYERS ----------

// ---------- Toggle LAYERS -----------
function ref(instance_or_id) {
	return(typeof(instance_or_id)=="string")?document.getElementById(instance_or_id):instance_or_id;
}
function toggleDisplay(divName) {
	var tempDiv = ref(divName);
	if (!tempDiv) {
		return false;
	}
	if ((tempDiv.style.display == "block") || (tempDiv.style.display == "" && tempDiv.className.indexOf("hid") == 0)) {
		tempDiv.style.display = "none";
		return false;
	} else if ((tempDiv.style.display == "none") || (tempDiv.className.indexOf("hid") != 0)) {
		tempDiv.style.display = "block";
		return true;
	}
}
// ---------- Toggle LAYERS -----------

// ------------ MM_scripts ------------
// ------------------------------------

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.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];}
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

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_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

function GP_popupConfirmMsg(msg) { //v1.0
  document.MM_returnValue = confirm(msg);
}
// ------------ MM_scripts ------------
