function showPop(thisurl){
	
		win2=window.open(thisurl, '', 'scrollbars=no, status=yes, left=0, top=0, width=1, height=1')
		win2.blur();
		
		document.getElementById('popup').style.minHeight = '662px';
		document.getElementById('popup').style.visibility = 'visible';

	}
	

function showCMS(what){
	
	var centerX = 0;
	var centerY = 0;
   if (window.screenX != null && window.outerWidth) {
      centerX = window.screenX + (window.outerWidth / 2);
      centerY = window.screenY + (window.outerHeight / 2);
   }
   else {
         centerX = window.screenLeft + (document.documentElement.offsetWidth / 2);
         centerY = window.screenTop + (document.documentElement.offsetHeight / 2);
      }

	
   var x = parseInt(centerX - (620 / 2));
   var y = parseInt(centerY - (352 / 2));
		
	if (what == 'show'){
				
		window.open('../home/pop.htm', '', 'scrollbars=0, left=' + x + ', top=' + y + ', width=620, height=352');
		document.getElementById('popup').style.visibility = 'visible';
	}
}


// live stuff
function getHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
var http = getHTTPObject();


function handleHttpResponse() {
  if (http.readyState == 4) {
    document.getElementById('middle').innerHTML = http.responseText;
  }
}
function handleHttpResponse2() {
  if (http.readyState == 4) {
	if (http.responseText){
    document.getElementById('livesearch').style.display = "block"; 
    document.getElementById('livesearch').innerHTML = http.responseText;
	}else{
    document.getElementById('livesearch').style.display = "none";
  }
  }
}

function setText(thevalue) {
		http.open("GET", "../pages/getCase.asp?id=" + thevalue, true);
		http.onreadystatechange = handleHttpResponse;
		http.send(null);
}

function liveSearch(thevalue) {
		http.open("GET", "../pages/livesearch.asp?search=" + thevalue, true);
		http.onreadystatechange = handleHttpResponse2;
		http.send(null);
}



function shownavi(what) {
	
	if(document.getElementById('case'+what)) {
	document.getElementById('case'+what).className="over";
	}
}
	
function showForm(whatform, onoff){
	
	//document.getElementById('brochure').style.display = 'none';
	//document.getElementById('login').style.display = 'none'
	//document.getElementById('newsfeed').style.display = 'none'

if (onoff == 'on'){
	document.getElementById(whatform).style.display = 'block';
	}
}

// flash stuff
var flashversion = 0;
	if (navigator.plugins && navigator.mimeTypes.length) {
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			var y = x.description;
   			flashversion = y.charAt(y.indexOf('.')-1);
		}
	} else {
		result = false;
	    for(var i = 15; i >= 3 && result != true; i--){
   			execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript');
   			flashversion = i;
   		}
	}
	
	document.write('<style>h1 span, h2 span {position: absolute; left: -9999px;}</style>')
	
function theflash(movie,width,height,text) {

	if (flashversion > 6)
{
	//alert(movie);
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+width+'" height="'+height+'">\n');
	document.write('<param name="movie" value="'+movie+'">\n');
	document.write('<param name="quality" value="high" />\n');
	document.write('<param name="menu" value="false">\n');
	document.write('<param name="scale" value="noscale" />\n');
	document.write('<param name="salign" value="lt" />\n');	
	document.write('<param name="wmode" value="transparent">\n');
	document.write('<embed src="'+movie+'" width="'+width+'" height="'+height+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false"  scale="noscale"  salign="lt" wmode="transparent"></embed>\n');
	document.write('</object>\n');
		
}
else
{
	document.write('<b>'+text+'</b>');
	
	}
}

var t = null;

window.onfocus = function onFocus(){
	if (document.getElementById('popup')){
		document.getElementById('popup').style.visibility = 'hidden';
	}
	
}

window.onload = function onLoader(){
	
	//other functions
	document.getElementById("topbar").onmouseover = function() {showForm('', 'off');}
	
	document.getElementById("topnavi").onmouseover = function() {
		showForm('', 'off');
		document.getElementById('livesearch').style.display = "none";
		}
	
	
	//document.getElementById("search").onkeyup = function() {
	//	if (t) {
	//		window.clearTimeout(t);
	//	}
	//	t = window.setTimeout("liveSearch('"+document.getElementById("search").value+"')",200);
	//}
	
	//document.getElementById("search").setAttribute("autocomplete", "off"); 
	
	

	// length of left column
	if (document.getElementById('intnavi')){
		if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) {
			document.getElementById('intnavi').style.height =  (document.getElementById('middle').offsetHeight) - 51 + 'px';
		}else if (navigator.userAgent.toLowerCase().indexOf('mozilla') != -1) {
			document.getElementById('intnavi').style.minHeight =  (document.getElementById('middle').offsetHeight) - 53 + 'px';
		}
	} 

	//Check for safari
	if (navigator.userAgent.toLowerCase().indexOf('safari') != -1) {
		
		//live search bits
		document.getElementById('livesearch').style.marginTop = "52px";
			searchField = document.getElementById('search');
		    searchField.setAttribute('type', 'search');
			searchField.setAttribute('autosave', 'at.rsnhq.search');
			searchField.setAttribute('results', '5');
			searchField.style.width = '160px';
			
		// change form text to #000 		
		var inputElement= new Array(5) 
			inputElement[0]="search"; 
			inputElement[1]="lUser"; 
			inputElement[2]="lPass"; 
			inputElement[3]="bName";		
			inputElement[4]="bAddress";
			inputElement[5]="bEmail";
			
			
		for (x=0; x<=5; x++) 
		{ 
		document.getElementById(inputElement[x]).style.color ='#000';
		}
	
	}


	//open window
	var x = document.getElementsByTagName('a');
	for (var i=0;i<x.length;i++)
	{
	if (x[i].getAttribute('title') >'') {
		
		if (x[i].getAttribute('title').indexOf("Link opens in a new window") >= 0)
		{
		x[i].onclick = function () {window.open(this.href); return false}
		}	
		}	
	}
	
	//load cookie for css switcher
	var cookie = readCookie("style");
	var title = cookie ? cookie : getPreferredStyleSheet();
	setActiveStyleSheet(title);
	
		//show correct size on navi
		if (cookie){
		cookiestr = cookie.toString();
			//if (document.getElementById(cookiestr)){
			//document.getElementById(cookiestr).className="on";
			//}else{
			//document.getElementById('Default').className="on";
			//}
		}else{
		//document.getElementById('Default').className="on";
		}
		
		//textchange navi
		//topnaviRoot = document.getElementById("textchange");
			
		//	for (i=0; i<topnaviRoot.childNodes.length; i++) {
		//		node = topnaviRoot.childNodes[i];
				
		//			if (node.nodeName=="LI") {
		//			node.onclick=function() {
						
		//				for (j=0; j<topnaviRoot.childNodes.length; j++) {
		//				topnaviRoot.childNodes[j].className="";
		//				}
		//				this.className="on";
		//				setActiveStyleSheet(this.id); return false;
		//			}
		//		}
		//	}
			
		//subnavi
		sidenaviRoot = document.getElementById("intnavi");
		
	if (sidenaviRoot){
		for (i=0; i<sidenaviRoot.childNodes.length; i++) {
			node = sidenaviRoot.childNodes[i];
			
			
				if (node.nodeName=="LI") {
				node.onclick=function() {
					
					for (j=0; j<sidenaviRoot.childNodes.length; j++) {
					sidenaviRoot.childNodes[j].className="";
					}
					
					this.className+=" over";
				}
			}
		}}
			
			
	//form
		var formRoot = document.getElementsByTagName("form"); 
		for (var f=0;f<formRoot.length;f++)
		{
			var r = formRoot[f].elements;
			var rlen = r.length;
	
			for (var h = 0; h < rlen; h++) {
			 var node = r[h];
					
						node.onfocus=function() {
						if(this.type !=='checkbox' && this.type !=='radio' && (this.tagName =='INPUT' || this.tagName =='TEXTAREA')) {
							if (this.tagName == 'TEXTAREA') {
								//this.className="formtextareafocus";
							}
							else {
								this.className="textformfocus";
							} 
							if (this.value.charAt(0) == '-') { this.value='' 
						}
				}
													
						node.onblur=function() {
						if(this.type !=='checkbox' && this.type !=='radio' && (this.tagName =='INPUT' || this.tagName =='TEXTAREA')) {
							if (this.tagName == 'TEXTAREA') {
								//this.className="formtextareafocus";
							}
							else {
								this.className="textform";
							}
						}
				}
			}
		}
	}
}	