function checkAll(prefix) {
	var elems=document.getElementsByTagName('input');
	for (i=0;i<elems.length;i++) {
		el=elems[i];
		if (el.type=='checkbox' && el.name.substr(0,prefix.length)==prefix) {
			el.checked=!el.checked;
			/*if (element.checked==true) {
				el.checked=true;
			} else {
				el.checked=false;
			}*/
		}
	}
}
activateMenu = function(nav) {
	/* currentStyle restricts the Javascript to IE only */
	if (document.all && document.getElementById(nav).currentStyle){
		navRoot = document.getElementsByTagName("li");
		for (i=0; i<navRoot.length; i++) {
			node = navRoot[i];
			node.onmouseover=function() {
			/*this.className=this.className.replace(" over", "")+" over";*/
				if (this.className.indexOf(" over")==-1){
					this.className=this.className+" over";
				}
			}
			node.onmouseout=function() {
				this.className=this.className.replace(" over", "");
				/*alert(this.className);*/
			}
		}
	}
}

function confirmDelete(delUrl,message) {
  if (confirm(message)) {
	document.location = delUrl;
  }
}

function swap(ident,name) {
	ident.src=name;
}

function getURLParam(strParamName){
  var strReturn = "";
  var strHref = window.location.href;
  // alert(strHref.indexOf("?"));
  if ( strHref.indexOf("?") > -1 ){
    var strQueryString = /*'&'+*/strHref.substr(strHref.indexOf("?")+1).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if (aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return strReturn;
}

function hightlightHost() {
	if (getURLParam('module')=='script_hosting_packs') {
		myclass='';
		if (getURLParam('host')=='mini') {
			myclass='td_1';
		}
		if (getURLParam('host')=='personal') {
			myclass='td_2';
		}
		if (getURLParam('host')=='basic') {
			myclass='td_3';
		}
		if (getURLParam('host')=='starter') {
			myclass='td_4';
		}
		if (getURLParam('host')=='business') {
			myclass='td_5';
		}
		if (getURLParam('host')=='pro') {
			myclass='td_6';
		}
		if (getURLParam('host')=='limited') {
			myclass='td_1';
		}
		if (getURLParam('host')=='unlimited') {
			myclass='td_2';
		}
		
		/*var output = [];*/ 
		if (myclass!='') {
			var tds = document.getElementsByTagName("td"); 
			for(var k=0;k<tds.length;k++) {
				if(tds[k].className == myclass) {
					tds[k].style.background='#FFCCCC';
					/*output[output.length] = tds[k];*/
				}
			}
		}
	}
}

function focus_start() {
	if (getURLParam('module')=='script_index') {
		document.domain_check.domain_name.focus();
	}
}


function copy_checkout(){
	var forma=document.checkout;
	forma.MOL.value=forma.first_name.value+" "+forma.last_name.value;
	forma.City.value=forma.user_city.value;
	forma.address.value=forma.user_address.value;
	
}
function copy_reg(){
	var forma=document.edit_user;
	forma.MOL.value=forma.first_name.value+" "+forma.last_name.value;
	forma.City.value=forma.user_city.value;
	forma.address.value=forma.user_address.value;
	
}

function loadall() {
	hightlightHost();
	focus_start();
}

window.onload=loadall;
