// JavaScript Document //****************************************************************************************************
var popUpWin=0;
var bLoad
bLoad=false;
var replacedfirst = false;
var replacedfirst2 = false;
var NS4 = (document.layers);
var IE4 = (document.all);
var win = this;
var n   = 0;
var MessageTimer


//****************************************************************************************************

function hidestatus(){
window.status=''
return true
}

if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)

document.onmouseover=hidestatus
document.onmouseout=hidestatus

//****************************************************************************************************

	document.writeln('<style type="text/css">');
	document.writeln('.MessageBoxBlock \{ display: none; \}');
	document.writeln('</style>');

function ShowMessage(XType){
	var	object='xThisMessage'
	ShowThis(object);
	if (XType=='True'){
		clearTimeout(MessageTimer);
		MessageTimer = setTimeout("HideThis('"+object+"');",10000);
	}
}
// ------------- Show Element Functions----------------------------------------------------------------------------------

function ShowThis(object) {
  if (document.getElementById) {
	document.getElementById(object).style.display = "block";
  }
  else if (document.layers && document.layers[object]) {
	document.all[object].display = "block"
  }
  else if (document.all) {
	document.all[object].style.display = "block";
  }
}

// -------------Hide Element Functions----------------------------------------------------------------------------------

function HideThis(object) {
  if (document.getElementById) {
	document.getElementById(object).style.display = "none"
  }
  else if (document.layers && document.layers[object]) {
	document.all[object].display = "none";
  }
  else if (document.all) {
	document.all[object].style.display = "none";
  }
}

function printWindow(){
   bV = parseInt(navigator.appVersion)
   if (bV >= 4) window.print()
}


function init() {
	if (bLoad) {
		// displayMode(HTMLModeSwapper,ShowFormattingToolbar)
		document.all.editBox.displayParams(true,true);
		if (X_EditBox==true){
			document.all.editBox.html = X_EditBoxContent;
		}
	}
	else {
		window.setTimeout("init()", 100);				
	}
}

//****************************************************************************************************

function wait() {
	window.setTimeout("init()", 30);
}

//****************************************************************************************************

function disable(FormName,ItemName){
	document.FormName.ItemName.disabled = 'checked';
}

//****************************************************************************************************

function enable(FormName,ItemName){
	document.FormName.ItemName.disabled = '';
}

//****************************************************************************************************

function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

//****************************************************************************************************

function SelectedYear()
{
	ThisItem=document.prop.programme.options[document.prop.programme.selectedIndex].value;
	if (ThisItem=="2002"){
		document.prop.Month.disabled = '';
	}else{
		document.prop.Month.disabled = 'checked';
	}
}

//****************************************************************************************************

function ValidatePageInput(theForm)
{
	var ContentText=document.all.editBox.html.replace(/X_include\//gi,"")
	theForm.Content.value = ContentText;
  if ((theForm.Name.value == "") || (theForm.SectionIndex.value == "") || (theForm.PageAccessReq.value == "") || (theForm.Content.value == "") || (theForm.SectionIndex.value == 0) || (theForm.PageAccessReq.value == 0))
  {
    alert("Please fill in all required fields marked with an *");
    return false;
  }
  return (true);
}

function ValidateCountry(theForm){

}


function ValidatePubAddition(theForm){
	if (theForm.Pub.value == ""){
		alert("The publication name is required");
		return false;
  	}
	  if (theForm.Industry.value == 0){
		alert("Please select an Industry");
		return false;
	  }
  return (true);
}

//****************************************************************************************************

function ValidateProjectInput(theForm)
{
  if ((theForm.Dated.value == "") || (theForm.Credit.value == "") || (theForm.CountryID.value == 0) || (theForm.STRating.value == 0))
  {
    alert("Please fill in all required fields marked with an *");
    return false;
  }
  if(theForm.DeptRecovery){
	  if(theForm.DeptRecovery.value == ""){
		alert("Please fill in all required fields marked with an *");
    	return false;  
	  }
  }
  return (true);
}

//****************************************************************************************************

function ValidateNewsInput(theForm)
{
	var ContentText=document.all.editBox.html.replace(/X_include\//gi,"")
	theForm.Content.value = ContentText;
  if ((theForm.Headline.value == "") || (theForm.AccessReq.value == "") || (theForm.Description.value == "") || (theForm.Content.value == "") || (theForm.AccessReq.value == 0) || (theForm.NewsType.value == 0))
  {
    alert("Please fill in all required fields marked with an *");
    return false;
  }
  return (true);
}

//****************************************************************************************************

function ValidateUploadInput(theForm)
{
if  (!theForm.FileName.value == "") {
			FileNameString=theForm.FileName.value;
			Xtent = FileNameString.slice(-4);
			if ((!Xtent==".doc") || (!Xtent==".pdf") || (!Xtent==".xls") || (!Xtent==".gif") || (!Xtent==".jpeg") || (!Xtent==".jpg") || (!Xtent==".swf")) { 
			alert("Only the following file types are allowed 'doc, pdf, xls, jpeg, jpg, gif, swf'");
			return false;
			}
			if ((Xtent == ".doc") || (Xtent == ".pdf") || (Xtent == ".xls")) { 
			theForm.Type.value = 2
			}
			if ((Xtent == ".jpeg") || (Xtent == ".jpg") || (Xtent == ".gif") || (Xtent == ".swf")) { 
			theForm.Type.value = 1
			}
			theForm.Ext.value = Xtent
		}  
	  if ((theForm.Name.value == "") || (theForm.Description.value == "") || (theForm.Category.value == "") || (theForm.Category.value == 0))
	  {
		alert("Please fill in all required fields marked with an *");
		return false;
	  }
	  return (true);
}

//****************************************************************************************************

function ValidateEventInput(theForm)
{
  if ((theForm.StartYear.value == "") || (theForm.StartMonth.value == "") || (theForm.StartDay.value == "") || (theForm.StartDay.value == 0) || (theForm.StartYear.value == 0) || (theForm.StartMonth.value == 0))
  {
    alert("Please check the start date");
    return false;
  }
  if ((theForm.EndYear.value == "") || (theForm.EndMonth.value == "") || (theForm.EndDay.value == "") || (theForm.EndDay.value == 0) || (theForm.EndYear.value == 0) || (theForm.EndMonth.value == 0))
  {
    alert("Please check the end date");
    return false;
  }
	X_Start=theForm.StartYear.value+"/"+theForm.StartMonth.value+"/"+theForm.StartDay.value
	X_End=theForm.EndYear.value+"/"+theForm.EndMonth.value+"/"+theForm.EndDay.value
	theForm.StartDate.value=X_Start
	theForm.EndDate.value=X_End
  theForm.Content.value = document.all.editBox.html;
  if ((theForm.Name.value == "") || (theForm.Description.value == "") || (theForm.Content.value == "") || (theForm.Content.value == 0) || (theForm.Type.value == 0) || (theForm.Type.value == ""))
  {
    alert("Please fill in all required fields marked with an *");
    return false;
  }
  return (true);
}

//****************************************************************************************************

function ValidateNewsletter(theForm){
	if ((theForm.Year.value==0) || (theForm.Month.value==0) || (theForm.Day.value==0)){
		alert("Please fill in the date fields");
    return false;
	}else{
	X_Date=theForm.Year.value+"/"+theForm.Month.value+"/"+theForm.Day.value
	theForm.PublicationDate.value=X_Date
	}
	if ((theForm.Name.value=="") || (theForm.Volume.value=="") || (theForm.Description.value=="") || (theForm.AccessReq.value==0) || (theForm.Image.value==0) || (theForm.Document0.value==0)){
		alert("Please fill in all fields marked with an *");
    return false;
	}
return (true);
}

//****************************************************************************************************

function ValidateFactsInput(theForm)
{
  //if ((theForm.Name.value == "") || (theForm.Description.value == "") || (theForm.Content.value == ""))
  if (theForm.Content.value == "")
  {
    alert("Please fill in all field marked with an *");
    return false;
  }
  return (true);
}

//****************************************************************************************************

function ValidateUserInput(theForm){
var text
  vartext=theForm.Email.value;
  text = vartext.toLowerCase();
  email = text
  
	if (theForm.UserLoggedIn.value=="True"){ 
		 if ((theForm.Name.value == "") || (theForm.Surname.value == "") || (theForm.Password.value == "") || (theForm.Email.value == "") || (theForm.Tel.value == ""))	{
			alert("Please fill in all required fields marked with an *");
			return false;
		}
	 }else{
	  if ((theForm.Name.value == "") || (theForm.Surname.value == "") ||(theForm.Email.value == "") || (theForm.Tel.value == "")|| (theForm.Postal.value == ""))
		{
			alert("Please fill in all required fields marked with an *");
			return false;
		}
	}
	charyn=/[0-9()+/\{}]/;
	if ((charyn.test(theForm.Name.value)) || (charyn.test(theForm.Surname.value))){
		alert("Please check your name and surname fields there seem to be numerals used");
		return false;
	}
	charynL=/[a-zA-Z]/;
    if (charynL.test(theForm.Tel.value)){
		alert("Please use only numbers in the Telephone field.");
	return false;
  	}
	// (theForm.Fax.value!=""){
		//if (charynL.test(theForm.Fax.value)){
			//alert("Please use only numbers in the Fax field.");
			//return false;
		//}
	//}
	if (!(CheckMailAddress(text))){
		return false;
	}
  return (true);
}


//****************************************************************************************************

function CheckMailladdress(text){
		if (text.indexOf("@")<2){
		alert(" This email address seems wrong. Please"
		+" check the .prefix and '@' sign.");
		return false;
	  }
  	if (text.indexOf(".")<4){
		alert(" This email address seems wrong. Please"
		+" check the suffix. (It should include a 'domain name' & .com, .edu,"
		+" .net, .org, .gov, .co.uk, .nl, .mil, co.za etc...)");
		return false;
	  }
}

//****************************************************************************************************

function ValidateUserInput2(theForm){
var text
  vartext=theForm.Email.value;
  text = vartext.toLowerCase();
  email = text
	  if ((theForm.Name.value == "") ||(theForm.Email.value == "") || (theForm.Tel.value == "") || (theForm.Fax.value == "") || (theForm.People.value == "") || (theForm.Area.value =="0"))
		{
			alert("Please fill in all required fields marked with an *");
			return false;
		}

	charyn=/[0-9()+/\{}]/;
	if ((charyn.test(theForm.Name.value))){
		alert("Please check your name and surname fields there seem to be numerals used");
		return false;
	}
	
	charynL=/[a-zA-Z]/;
    if (charynL.test(theForm.Tel.value)){
		alert("Please use only numbers in the Telephone field.");
	return false;
  	}
	
	if (theForm.Fax.value!=""){
		if (charynL.test(theForm.Fax.value)){
			alert("Please use only numbers in the Fax field.");
			return false;
		}
	}
		
	if (theForm.People.value!=""){
		if (charynL.test(theForm.People.value)){
			alert("Please use only numbers in the No. of People field.");
			return false;
		}
	}
	
	if (!(CheckMailAddress(text))){
		return false;
	}
  return (true);
}

//****************************************************************************************************

function confirmDelete()
{
var agree=confirm("Are you sure you wish to delete?");
if (agree)
	return true ;
else
	return false ;
}

function popUpWindow(URLStr, left, top, width, height, Type, Link)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
	popUpWin = open(URLStr+'&x='+Type+'&Tx='+Link, 'popUpWin', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
//****************************************************************************************************

function ValidateSearchInput(theForm)
{
	X_Start=theForm.StartYear.value+"/"+theForm.StartMonth.value+"/"+theForm.StartDay.value
	X_End=theForm.EndYear.value+"/"+theForm.EndMonth.value+"/"+theForm.EndDay.value
	theForm.StartDate.value=X_Start
	theForm.EndDate.value=X_End
	if ((theForm.Searchtext.value == "") || (theForm.Searchtext.value == "")){
		alert("Please fill in all required fields marked with an *");
    return false;
	}
	if (!(theForm.StartYear.value==0) || !(theForm.StartMonth.value==0) || !(theForm.StartDay.value==0)){
		if ((theForm.StartYear.value==0) || (theForm.StartMonth.value==0) || (theForm.StartDay.value==0) || (theForm.EndYear.value==0) || (theForm.EndMonth.value==0) || (theForm.EndDay.value==0)){
			alert("Please fill in all the date fields");
    		return false;
		}
	}
  return (true);
}

//****************************************************************************************************

function ValidateProjectsInput(theForm){
	X_Start=theForm.StartYear.value+"/"+theForm.StartMonth.value+"/"+theForm.StartDay.value
	theForm.StartDate.value=X_Start
}

//****************************************************************************************************

function AddUsers(){
    for (var Current=0;Current < document.Form.SelectBoxUsers.options.length;Current++) {
        if (document.Form.SelectBoxUsers.options[Current].selected) {
            var defaultSelected = true, selected = true;
	 var option = (document.Form.SelectBoxUsers.options[Current].value)
            if (replacedfirst)
         		var length = document.Form.UserGroup.length;
            else
                var length = 0;
					document.Form.UserGroup.value = document.Form.UserGroup.value + option + ";";
            replacedfirst = true;
       	}
	}
}

//****************************************************************************************************

function AddCompanies(){

    for (var Current=0;Current < document.Form.SelectBoxCompanies.options.length;Current++) {
        if (document.Form.SelectBoxCompanies.options[Current].selected) {
            var defaultSelected = true, selected = true;
			 var option2 = (document.Form.SelectBoxCompanies.options[Current].text)
            if (replacedfirst2)
         		var length = document.Form.CompanyGroup.length;
            else
                var length = 0;
					document.Form.CompanyGroup.value = document.Form.CompanyGroup.value + option2 + ";";
            replacedfirst2 = true;
		}
	}
}

//****************************************************************************************************
//* Email Validation *********************************************************************************
//****************************************************************************************************

function ValidateEmailerInput(theForm){
var text
  vartext=theForm.Email.value;
  text = vartext.toLowerCase();
  email = text
  
  if ((theForm.Name.value == "") || (theForm.Surname.value == "") || (theForm.xMessage.value == ""))
  {
    alert("Please fill in all required fields marked with an *");
    return false;
  }
	
	if (!(CheckMailAddress(text))){
		return false;
	}
	
  return (true);
}

//****************************************************************************************************

function CheckMailAddress(email){
	if (email.indexOf("@")<2){
		alert(" This email address seems wrong. Please"
		+" check the .prefix and '@' sign.");
		return false;
	  }
  	if (email.indexOf(".")<4){
		alert(" This email address seems wrong. Please"
		+" check the suffix. (It should include a 'domain name' & .com, .edu,"
		+" .net, .org, .gov, .co.uk, .nl, .mil, co.za etc...)");
		return false;
	  }
  return (true);
}

//****************************************************************************************************
//* Color Picker *************************************************************************************
//****************************************************************************************************

function SelectColor(Element,colorSelectID){
	document.Form[colorSelectID].value=Element.options[Element.selectedIndex].value;
}

//****************************************************************************************************

function ValidateStyleInput(theForm)
{

var X_Length=theForm.elements.length
	for ( var i=0; i < X_Length; i ++) {
		if (theForm.elements[i].value==0) {
			if (theForm.elements[i].type=="select-one"){
				theForm.elements[i].value=''
				alert(theForm.elements[i].name+'    '+theForm.elements[i].value)
			}
		}
	}
	//return false
}
function MakeThumbnails(FileName)
{
	var Thumbnailer=new ActiveXObject("Thumbnailer.ThumbnailMaker");
	var SourceFileName=FileName;
	var DestFileName=Thumbnailer.CreateThumbnail(SourceFileName,64,64);
	return DestFileName;
}

function SelectPhoto(PicName)
{
	var pic=document.getElementById(PicName+'Field');
	var pic_preview=document.getElementById(PicName+'_preview');
	var pic_box=document.getElementById(PicName+'_box');
	pic_preview.src=pic.value;
	pic_preview.style.display='';
	pic_name=document.getElementById(PicName+'_name');
	pic_name.innerText=pic.value;
	pic_box.style.display='';

	if (pic.value=="") return;
	ThumbnailSrc=MakeThumbnails(pic.value);
	alert("A thumbnail image was created on your drive, called:\n"+ThumbnailSrc+"\n\nYou have to include this image as a thumbnail. Please select it now.");
}

function SelectThumb(PicName)
{
	var picThumbField=document.getElementById(PicName+'ThumbField');
	var pic_thumb=document.getElementById(PicName+'_thumb');
	ThumbnailSrc=picThumbField.value;
	pic_thumb.src=ThumbnailSrc;
	pic_thumb.style.display='';
}

	function Add(theList,arCnt,arrList){
		var polLoc;
		saved = false;
		theForm = document.forms[1];
		arrList[eval(arCnt + "++")]  = theForm.txtHL.value;
		polLoc = theList.length;
		theList.options[polLoc] = new Option( polLoc + "   " + (theForm.txtHL.value).substr(0,20) + "...", eval(arCnt));
		theForm.txtHL.value = "";
	}
	function Remove(theList,arCnt,arrList){
		saved = false;
	    zap = theList.selectedIndex;
	    if ( zap == 0 || zap==-1) return; // can't zap the heading
		
	    msg = "Are you sure you want to remove entry number " + theList.options[zap].value + "?";
	    if ( ! confirm( msg ) )
	        return;

	    // move all items past the zapped on up a slot
	    for ( ix = zap-1; ix < eval(arCnt); ix++ )
	        arrList[ix]  = arrList[ix+1];
	
	    // shrink the arrays
	    arrList.length = eval("--" + arCnt);
	
	    // and fix up the list
	    for (ix=theList.options.length+1;ix>=1;ix--){theList.options.remove(ix)}
	    for (ix=1;ix<=arrList.length;ix++)
				theList.options[ix] = new Option( ix + "   " + (arrList[ix-1]).substr(0,20) + "...", ix );
	}

	function Edit(theList,arCnt,arrList){
		saved = false;
	    zap = theList.selectedIndex;
		theForm = document.forms[1];
	    if ( zap == 0 || zap==-1) return; // can't zap the heading
		//alert(theForm.txtHL.value)
		theForm.txtHL.value = arrList[zap-1]
		//newValue = prompt("Edit item:",arrList[zap-1]);
		//if (newValue==null) return(true);
		//while(newValue=="") {
			//newValue = prompt("This item cannot be empty:",arrList[zap-1]);
			//if (newValue==null) return(true);
		//}
		 for ( ix = zap-1; ix < eval(arCnt); ix++ )
	        arrList[ix]  = arrList[ix+1];
	
	    // shrink the arrays
	    arrList.length = eval("--" + arCnt);
		//arrList[zap-1] = newValue;
	    // and fix up the list
	    for (ix=theList.options.length+1;ix>=1;ix--){theList.options.remove(ix)}
	    for (ix=1;ix<=arrList.length;ix++)
				theList.options[ix] = new Option( ix + "   " + (arrList[ix-1]).substr(0,20) + "...", ix );
	}

	function listItems(theList,arCnt,arrList){
		for(i=0;i<arrPolitical.length;i++)
			alert(arrPolitical[i]);
	}
	
	function updateItems(){
		if(arrSTExperience!=null){
			theList = document.forms[1].STExperience;
			for (ix=1;ix<=arrSTExperience.length;ix++)
				theList.options[ix] = new Option( ix + "   " + (arrSTExperience[ix-1]).substr(0,35) + "...", ix );
		}
		theList = document.forms[1].Political;
		for (ix=1;ix<=arrPolitical.length;ix++)
				theList.options[ix] = new Option( ix + "   " + (arrPolitical[ix-1]).substr(0,35) + "...", ix );
		theList = document.forms[1].Economic;
				//theList = Form1.Economic;
		for (ix=1;ix<=arrEconomic.length;ix++)
				theList.options[ix] = new Option( ix + "   " + (arrEconomic[ix-1]).substr(0,35) + "...", ix );
		theList = document.forms[1].Trade;
				//theList = Form1.Trade;
		for (ix=1;ix<=arrTrade.length;ix++)
				theList.options[ix] = new Option( ix + "   " + (arrTrade[ix-1]).substr(0,35) + "...", ix );
	}
	
	function ClosePage(){
		if(saved!=false)
			window.close();
		else{
			 if (confirm("Are you sure you want to close without saving?")==true)
				window.close();
			 else return(false);
		}
	}
	
	function saveItems(){
		saved = true;
		if(arrSTExperience!=null){
			for (ix=0;ix<arrSTExperience.length;ix++)
				while((arrSTExperience[ix]).search(",")>-1)
					arrSTExperience[ix] = (arrSTExperience[ix]).replace(",", "||");
		}
		for (ix=0;ix<arrPolitical.length;ix++)
			while((arrPolitical[ix]).search(",")>-1)
				arrPolitical[ix] = (arrPolitical[ix]).replace(",", "||");
		for (ix=0;ix<arrEconomic.length;ix++)
			while((arrEconomic[ix]).search(",")>-1)
				arrEconomic[ix] = (arrEconomic[ix]).replace(",", "||");
		for (ix=0;ix<arrTrade.length;ix++)
			while((arrTrade[ix]).search(",")>-1)
				arrTrade[ix] = (arrTrade[ix]).replace(",", "||");
		//Call the save page
			if(arrSTExperience!=null){
				document.forms[1].arrxExperience.value = arrSTExperience.toString();
			}
			document.forms[1].arrxPolitical.value = arrPolitical.toString();
			document.forms[1].arrxEconomic.value = arrEconomic.toString();
			document.forms[1].arrxTrade.value = arrTrade.toString();
			document.forms[1].submit();
		return(true);
	}

	function DeleteDiv(objEl){
		if(confirm("Are you sure you would like to delete this item?")==true){
			while(objEl.tagName!="TABLE")
				objEl=objEl.parentElement;
			objEl.outerHTML="";
		}
	}
	
	function AddDiv(objEl,XType){
		var oDiv=document.createElement("DIV");
		var DivTab
		infoBlock.appendChild(oDiv);
		DivTab="<table><tr><td class='xBodyText'><textarea name='Flash' id='Flash' cols='50' rows='4' class='xinputBox'></textarea>"
		//if (XType=0){
			//DivTab=DivTab+"Source : <input name='Sources' type='text' value='' size='25' maxlength='255' class='xinputBox'>&nbsp;&nbsp;"
		//}
		DivTab=DivTab+"&nbsp;<a id=DelDiv href=\"#\" onClick=\"DeleteDiv(this);\">Delete</a></td></tr></table>";
		oDiv.outerHTML=DivTab
	}
	

		function SaveFlashes(ThisForm,XType){
		var flshList
		var flshSource
		if (document.getElementsByName("Flash").length > 0){
		var XLength=ThisForm.Flash.length;
		if (XType==0){
			var XSourceLength=ThisForm.Flash.length;
		}
			if (typeof XLength!=='undefined'){ 
				for(i=0;i<(ThisForm.Flash.length);i++){
					if (i >0) {
						flshList=flshList+"#"+ThisForm.Flash[i].value
						}else{
						flshList=ThisForm.Flash[i].value
						}
					}
			}else{
			flshList=ThisForm.Flash.value;
			}
			//------------
			if (XType==0){
				if (typeof XLength!=='undefined'){ 
					for(i=0;i<(ThisForm.Sources.length);i++){
						if (i >0) {
							flshSource=flshSource+"#"+ThisForm.Sources[i].value;
							}else{
							flshSource=ThisForm.Sources[i].value;
							}
						}
						
				}else{
					flshSource=ThisForm.Sources.value;	
				}
				ThisForm.SourcesArray.value=flshSource;
			}
			//---------
			ThisForm.FlashArray.value=flshList;
		}
			if (XType==0){
				ThisForm.F.value="ExportFlashes"
			}else{
				ThisForm.F.value="IndustryFlashes"
			}
		return(true);
	}
	var chkAdmin = document.location.href.search("adminid");
		function CheckEmptyFields(){
		}
		
	function docClick(){
		var srcEl = window.event.srcElement;
		var tmp = document.all.tmp;
		var strHTML,rows,cols;
		if(document.getElementById("tmp")!=null && srcEl.id!="tmp"){
			strHTML = tmp.innerText;
			tmp.parentElement.innerText = strHTML;
			//CheckEmptyFields();
		}
		if(srcEl.id=="edit"){
				strHTML = srcEl.innerText;
				rows=srcEl.getAttribute("rows");
				cols=srcEl.getAttribute("cols");
				srcEl.innerHTML = "<textarea rows=" + rows + " id=tmp cols=" + cols + ">" + strHTML + "</textarea>";
		}
	}




function QSHandler() {
	var qs = location.search.substr(1).split("&");
	this.data = [];
	for(var i = 0; i < qs.length; i++) this.data[qs[i].split("=")[0]] = qs[i].split("=")[1];

this.QueryString = function(x) {
return this.data[x];
	};
} 

var Request = new QSHandler();
var SearchString = Request.QueryString("srch");

function findInPage(str) {
var txt, i, found;
	if (str == ""){
		return false;
	}else{
		if (document.layers) {
				if (!win.find(str)){
					while(win.find(str, false, true))
					n++;
				}else{
					n++;
					if (n == 0) alert(str + " was not found on this page.");
				}
		}else {
			txt = win.document.body.createTextRange();
				for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
					txt.moveStart("character", 1);
					txt.moveEnd("textedit");
				}
				if (found) {
				txt.moveStart("character", -1);
					txt.findText(str);
					txt.select();
					txt.scrollIntoView();
					n++;
				}else {
					if (n > 0) {
					n = 0;
					findInPage(str);
				}
			}
			//alert(str + " was not found on this page.");
		}
	}
	//return false;
}



