function imgOnOff(pthis, pclass){
  pthis.className = "bg " + pclass;
}

function showEmailPopUp(){
   var capa = document.getElementById("emailPopUp");
   capa.style.display = "block";
   capa.style.visibility = "";
}

function hideEmailPopUp(){
   var capa = document.getElementById("emailPopUp");
   capa.style.display = "none";
   capa.style.visibility = "hidden";
}

function showPOP(ID, pops) {
	var totalPops = pops + 1;
	for (i=1; i < totalPops; i++) {
		var obj = document.getElementById('pop'+i);
		if(i==ID) {obj.style.visibility = 'visible';}
		else      {obj.style.visibility = 'hidden';}
	}
}

function hidePOP(ID) {
	var obj = document.getElementById('pop'+ID);
	obj.style.visibility = 'hidden';
}

function funcAjax() {
	var xmlhttp=false;
	try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
	catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } }
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); }
	return xmlhttp;
}

function switchBOX(ID, act) {
	if(act=="show") {
		var popsToHide = document.getElementsByTagName("div");
		for (i = 0; i < popsToHide.length; i++) {
			if(popsToHide[i].id.substr(0, 4) == "popX") {
				popsToHide[i].style.display    = "none";
				popsToHide[i].style.visibility = "hidden";
			}
		}
	}
	var obj = document.getElementById(ID);
	obj.style.display    = (obj.style.display    != "block")? "block" : "none"  ;
	obj.style.visibility = (obj.style.visibility != ""     )? ""      : "hidden";
}

function opX(theURL,winName,features) { window.open(theURL,winName,features); }

function opXtreme(theURL,winName,features) {
  screenRatio = 0.70;
  LeftPosition=(screen.width)?(screen.width-(screen.width*screenRatio))/2:100;
  TopPosition=(screen.height)?(screen.height-(screen.height*screenRatio))/2:100;
  features += ", left=" + LeftPosition + ", top=" + TopPosition;
  features += ", width=" + (screen.width*screenRatio) + ", height=" + (screen.height*screenRatio);
  window.open(theURL,winName,features);
}

function empINFO(ID) {
		var obj4 = document.getElementById('empCmb');
	if(!isNaN(ID)) {
		var obj1 = document.getElementById('empInfo');
		var obj2 = document.getElementById('empInfoCont');
		var obj3 = document.getElementById('defInfo');

		var unNum = new Date();
		unNum = unNum.getSeconds() + "" + unNum.getMilliseconds();

		var str = "";
		unNum=funcAjax();
		str = "getInfo=" + ID;
		unNum.open("POST", "pages/aboutus.teamprofiles.getinfo.php", true);

		unNum.onreadystatechange=function() {
			if(unNum.readyState==4) {
				result = unNum.responseText;
				arr = result.split("|");
				obj3.style.visibility = "hidden";
				obj4.value = ID;
				obj1.style.visibility = "visible";
				obj2.innerHTML = result;
			}
		}
		unNum.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		unNum.send(str);
	} else {
		obj4.value = "NaN";
	}
}

function contMail(formName, resDiv) {
	resDiv = resDiv || 'formDIV';
	var obj = document.getElementById(formName);
  var str = "";

	var unNum = new Date();
	unNum = unNum.getSeconds() + "" + unNum.getMilliseconds();
	unNum = funcAjax();

	if(formName == "frmContactUs") {
		unNum.open("POST", "pages/contactus.mail.php", true);
		str = "action=sendMail";
		str += "&MType=" + obj.MType.options[obj.MType.selectedIndex].text;
		str += "&FName=" + obj.FName.value;
		str += "&Email=" + obj.Email.value;
		str += "&Phone=" + obj.Phone.value;
		str += "&Sbjct=" + obj.Sbjct.value;
		str += "&Notes=" + obj.Notes.value;
	}

	if(formName == "frmForgotPass") {
		unNum.open("POST", "pages/support.password.php", true);
		str = "action=recPass";
		str += "&name=" + obj.name.value;
		str += "&mail=" + obj.mail.value;
	}

	if(formName == "frmNewAccount") {
		unNum.open("POST", "pages/support.newacc.php", true);
		str = "action=newAcc";
		str += "&name=" + obj.name.value;
		str += "&comp=" + obj.comp.value;
		str += "&mail=" + obj.mail.value;
	}

	if(formName == "frmSendMail") {
		unNum.open("POST", "pages/support.mail.php", true);
		str = "action=sendMail";
		str += "&name=" + obj.name.value;
		str += "&mail=" + obj.mail.value;
		str += "&ques=" + obj.ques.value;
	}

	unNum.onreadystatechange=function() {
		if(unNum.readyState==4) {
			result = unNum.responseText;
			if(result=="") {
				document.getElementById(resDiv).innerHTML = "Your message has been sent.";
				window.location.href='index.php?p=contactus';
			} else {
				document.getElementById(resDiv).innerHTML = "Error: Your message could not be sent.";
			}
		} else {
			document.getElementById(resDiv).innerHTML = "Sending ...";
		}
	}
	unNum.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	unNum.send(str);
}

function openLiveHelp(){
	window.open("https://secure.logmeinrescue.com/Customer/Download.aspx?EntryID=1584993091");
}

function MoveIPP(url, action, page, response){
	var obj = document.getElementById(response);
	var unNum = new Date();
	unNum = unNum.getSeconds() + "" + unNum.getMilliseconds();

	var str = "";
	unNum=funcAjax();
	str = "action=" + action + "&itmPage=" + page;
	unNum.open("POST", url, true);

	unNum.onreadystatechange=function() {
		if(unNum.readyState==4) {
			result = unNum.responseText;
			obj.innerHTML = result;
		}
	}
	unNum.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	unNum.send(str);
}