// JavaScript Document
var strBaseUrl = "http://" + window.location.hostname//"http://scidotdeva";
var strAppsUrl = "http://" + window.location.hostname//"http://scidotdeva";

if (strBaseUrl =="http://www.wavecorporate.com")
	{
	strBaseUrl = "http://www.wavecorporate.com";
	}
if (strAppsUrl =="http://www.wavecorporate.com")
	{
	strAppsUrl = "http://www.wavecorporate.com";
	}


if (strBaseUrl == "http://scidotdeva")
	{
	strBaseUrl = "http://scidotdeva";
	}


//This part is the new part

//------------------------------ Search Form Function ------------------------------//
function checkValid() {
	if(document.formsearch.CiRestriction.value == ''){
		alert("Please type your keywords.");
		return false;
	}
	var reg2 = /[,|~|{|[|}|!|#|$|%|^|*|(|)|=|<|>|?|'|;|||]/;	
	 
	if ( reg2.test(document.formsearch.CiRestriction.value)){
		alert("Non alphanumeric characters are not allowed.");
		return false;	
	 }
    var str = document.formsearch.CiRestriction.value;
 
	 if  (str.indexOf(']')> -1){
		alert("Non alphanumeric characters are not allowed.");
		return false;
	}	
	if  (str.indexOf('\\')> -1){
		alert("Non alphanumeric characters are not allowed.");
		return false;
	}		
	if  (str.indexOf('../_default.htm')> -1){
		alert("Non alphanumeric characters are not allowed.");
		return false;
	}
	if  (str.indexOf(' ')== 0){
		alert("A space is not allowed as the first character.");
		return false;
	}	
	if  (str.indexOf(' ')== 1 &&  str.indexOf(' ',2)== 3){
		alert("A search string can not contain that many single chacters in a row.");
		return false;
	}				
	if (str.length == 3 && str.indexOf(' ')== 1){
		alert("Not enough valid alphanumeric characters to search on.");
		return false;
	}			
	if  (str.indexOf('__')> -1){
		alert("Non alphanumeric characters are not allowed.");
		return false;
	}	
	if (str.length==3 && str.indexOf('_')== 0 && str.lastIndexOf('_')== 2  ){
		alert("You search string must contain at least three alphanumeric characters.");
		return false;
	}		
	if (str.length<3){
		alert("You search string must contain at least three alphanumeric characters.");
		return false;
		}else{
		openNewWindow('/query_dev.idq?CiRestriction=' + document.getElementById("CiRestriction").value + '','Search','500','500');
		return true;
	}
}
//------------------------------ Education Include -----------------------------------//
//------------------------------- HEADER N FOOTER ------------------------------------//	

function pageTop()
	{
	var strText = "";
strText += "<tr valign=\"top\">";
strText += "  <td height=\"54\" colspan=\"3\">";
  document.write(strText);

 buildHeader();
strText = "";
strText += "</td></tr>";
strText += "<tr><td height=\"32\" colspan=\"3\">";
  document.write(strText);
    buildNav();
strText = "";
strText += "</td></tr>";
document.write(strText);
}

function buildFooterSmall()
	{
	var text = "";
	text += "<span align=\"right\" class=\"smallText\">&copy; 2007 Wave Corporate Software. All Rights Reserved</span>";
	document.write (text);
	}


//------------------------------- MENU SYSTEM ------------------------------------//	
menuTimer=0;

function setTimer() {
	menuTimer=setTimeout("hideAll()",500);
}

function clrTimer() {
	clearTimeout(menuTimer);
}
function hideAll() { 
	hideLayer('dd1','dd2','dd3','dd4','dd5','dd6'); 
	clrTimer();
}	
function showLayer() {
	hideAll();
	var n=showLayer.arguments.length; 
	for (var i=0; i<n; i++) { 
		var lyr = document.getElementById(showLayer.arguments[i]).style;
		if(lyr) { 
			lyr.visibility="visible";
		} 
	} 
} 
function hideLayer() { 
	var n=hideLayer.arguments.length; 
	for (var i=0; i<n; i++) { 
		var lyr = document.getElementById(hideLayer.arguments[i]).style; 
		if(lyr) { 
			lyr.visibility = "hidden";
		} 
	} 
}

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 openNewWindow(myURL, myTitle, myWidth, myHeight)
	{
	window.open(myURL,myTitle,'toolbar=no,width=' + myWidth + ',height=' + myHeight + ',directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no,location=no,copyhistory=no,alwaysraised=yes');
	}



function openNewWindowEMEA(myURL, myTitle, myWidth, myHeight)
	{
		if(confirm("You are being redirected to the US site. Is this ok?"))
		{
		window.open(myURL,myTitle,'toolbar=no,width=' + myWidth + ',height=' + myHeight + ',directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no,location=no,copyhistory=no,alwaysraised=yes');
		}
	}
	
		// embed the flash s
		// embed the flash swf

function SpotLight(){
var axel = Math.random()+"";
var a = axel * 10000000000000;
document.write('<img src="http://ad.doubleclick.net/activity;src=1166245;type=sterl472;cat=sterl721;ord=1;num='+ a + '?" width="1" height="1" border="0" ../default.htm>');
}
