// Shared functions
//JCAMEN
if (window.createPopup && document.compatMode && document.compatMode=="CSS1Compat"){
  document.onreadystatechange = onresize = function fixIE6AbsPos(){
    if (!document.body) return;
    if (document.body.style.margin != "0px") document.body.style.margin = 0;
    onresize = null;
    document.body.style.height = 0;
    setTimeout(function(){ document.body.style.height = document.documentElement.scrollHeight+"px"; }, 1);
    setTimeout(function(){ onresize = fixIE6AbsPos; }, 100); 
  }
}
appendFunctionToOnLoadEvent('window.focus();alert(123)');


function arch_func()
   {
   var w = document.archform.archlist.value;
   window.location=w;
   }

//JCAMEND

function removeSpaces(strIn) {
	while(strIn.indexOf(" ")>-1) {
		strIn = strIn.replace(" ","");
	}
	return strIn;
}

function arrayContainsValue(arrayToCheck, value) {
	//alert("10 "+value);
	var retVal = false;
	
	for(var intArrayPosition=0; intArrayPosition < arrayToCheck.length; intArrayPosition++) {
		if(arrayToCheck[intArrayPosition]==value) {
			retVal = true;
			break;	
		}
	}
	
	return retVal;	
}

function w3cSetInnerHTML(el,content) {
	//alert("24 "+el.id);
	if(document.all) {
		el.innerHTML = content;
	}
	else if(document.getElementById) {
		var rng = document.createRange();
		rng.setStartBefore(el);
		var htmlFrag = rng.createContextualFragment(content);
		
		// Clear element content first
		w3cClearAllChildElements(el);
	
		// Now repopulate
		el.appendChild(htmlFrag);
	}
}

function w3cClearAllChildElements(el) {
	// Clear element content first
	//alert("42 "+el.id);
	while(el.hasChildNodes()) {
		el.removeChild(el.lastChild);
	}
}

function appendFunctionToOnLoadEvent(func) {
  //alert("48 "+func);
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function checkform() {
var obj=document.getElementById('commentform');
var m="",f="",c="\n",v="",err=0,e,el;

for (var i=0;i<obj.elements.length;i++){
	el=obj.elements[i];
	e=el.id;
	
	if(el.value=="" && e != "url"){ 
		
		m+="\n"+e;
		f=(f=="") ? e : f;
		}
	}
if (m!="") {
	alert ("The information below is required:-"+m);
	err=1;
	}
if (!err){return(true)}
else{putFocus(f);return(false)}
}

function putFocus(el) {
if ("object"!=typeof el){el=document.getElementById(el);el.focus();
				if (el.type=='text'){el.select();}
}else{
    	if (document.forms.length > 0) {
			if(document.forms[0].elements[el]){
     			if ("string"==typeof(el)){$i="";
     			}else{$i=((document.forms[0].elements[el].type)=="submit") ? 1:0}
      	document.forms[0].elements[el+$i].focus();
      	}
		}
	}
//return (false);
}



