// Checks and verify Email
function emailCheck(str){
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	// check if string contains @sign
	if (str.indexOf(at)==-1){
	   return false
	}
	// check if @sign not at beginning of string
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false
	}
	// check if period not at beginning of string
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		return false
	}

	if (str.indexOf(at,(lat+1))!=-1){
		return false
	}

	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false
	}

	if (str.indexOf(dot,(lat+2))==-1){
		return false
	}
	
	if (str.indexOf(" ")!=-1){
		return false
	}

	 return true					
}// end function emailCheck


function mouseReallyOut(obj) {

if (!event.fromElement.contains(event.toElement) &&!document.getElementById(obj).contains(event.toElement))
{
	alert('out');//do something on mouse out;
}

return false;
}

function preloadImages(img_list) {
	var imgs = toArray(img_list);
	var step = 0;
	
	imgs.each(function(img) {
		var preload = new Image();
		preload.src = imgs[img].value;
		alert(preload.src);
	});
}

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();


/////////////////////////////////////////////
//
// collapse box for the login menu
// in right side, netpass and webmail login
//
/////////////////////////////////////////////
function slider(obj, obj2, objHide, ele){


	var imagePath = "/assets/images";
	objId1 = document.getElementById(obj).style.display
	objId2 = document.getElementById(obj2).style.display
	//objId3 = document.getElementById(objHide).style.display
	


	//'slide_wadmin','slide_webmail', 'slide_epay'
	
	//document.getElementById("red_arrow").innerHTML = "<img src=\""+imagePath+"/red_arrow.png\" border=\"0\">";
	document.getElementById("blue_arrow").innerHTML = "<img src=\""+imagePath+"/blue_arrow.png\" border=\"0\">";
	document.getElementById("orange_arrow").innerHTML = "<img src=\""+imagePath+"/orange_arrow.png\" border=\"0\">";

	

	
	document.getElementById(ele).innerHTML = "<img src=\""+imagePath+"/"+ele+"_down.png\" border=\"0\">";

	if (objId1 == "none"){
	
			
		// slide effect

		if (objId2 != "none"){

			Effect.SlideUp(obj2, {
				afterFinish: function( ){
					/*
					if (objId3 != "none"){
						Effect.SlideUp(objHide);
					}
					*/
					Effect.SlideDown(obj);
				}
			});
		}
		/*
		else if (objId3 != "none"){
			Effect.SlideUp(objHide, {
				afterFinish: function( ){
					Effect.SlideDown(obj);
				}

			});
		}
		*/
		
	
	}
/*
	else{
		// swaps images arrows
		//document.getElementById("redArrow").innerHTML = "<img src=\""+imagePath+"/red_arrow.png\" border=\"0\">";
		document.getElementById("blueArrow").innerHTML = "<img src=\""+imagePath+"/blue_arrow_down.png\" border=\"0\">";
		document.getElementById("orangeArrow").innerHTML = "<img src=\""+imagePath+"/orange_arrow.png\" border=\"0\">";
		// slide effect
		Effect.SlideUp(obj, {
			afterFinish: function( ){
				if (objId3 != "none"){
					Effect.SlideUp(objHide);
				}
				Effect.SlideDown(obj2)
			}
		});
		
	}
*/
	return false;

}



function clearText(obj){
	
	if (obj.value == obj.title){
		obj.value = ''
	}
	else if(obj.value == ''){
		obj.value = obj.title;
	}
}



///////////////////////////////////////////////////////////
// default text on form fields.  
// if users click on input field the data will clear.
// if users input data other than default data, it will 
// save it
///////////////////////////////////////////////////////////
function defaultText(obj, eventType, id){
	var browserName=navigator.appName; 
	if (eventType == "focus"){
		if (obj.value == obj.title){
			obj.value = "";
		}// end if

		// change password field type to password
		if (obj.title == 'password'){
			if (browserName!="Microsoft Internet Explorer"){

				obj.type = 'password';

			}// end if browser check
			else{
				// do ie text change to password for ie
				
				if (id == "password2"){
				//password_field = document.elements('user[password]');
				document.getElementById(id).innerHTML = "<input type=\"password\" class=\"inputField\" name=\"user[password]\" stlye=\"position:relative;z-index-500;\" title=\"password\" value=\"\" onblur=\"defaultText(this, 'blur', '"+id+"')\" />";
				rightLogin.elements[1].focus();
				rightLogin.elements[1].focus();
				}
				else{

					document.getElementById(id).innerHTML = "<input type=\"password\" class=\"inputField\" name=\"password\" style=\"position:relative;z-index-500;\" title=\"password\" value=\"\" onblur=\"defaultText(this, 'blur', '"+id+"')\" />";
					
					pass_id = document.getElementById(id).getAttribute('id');
					rightLogin2.password.focus();
					rightLogin2.password.focus();



				}
			}// end else browser check
		} // end if

		

	}
	else{
		if (obj.value == ""){
			obj.value = obj.title;


			// change input type back to text if password is left blank
			if (obj.title == 'password'){
				if (browserName!="Microsoft Internet Explorer"){
					obj.type = 'text';
				}// end if browser check
				else{
				// revert password back to input text for ie

					document.getElementById(id).innerHTML = "<input type=\"text\" class=\"inputField\" name=\"password\" style=\"position:relative;z-index-500;\" title=\"password\" value=\"password\"  onfocus=\"defaultText(this, 'focus', '"+id+"')\" onblur=\"defaultText(this, 'blur', '"+id+"')\" />";

				}// end else browser check
			}// end if
			

		}// end if object value empty
	}// end else
}// defaultText function



function defaultText_sp(obj, eventType, id){
	var browserName=navigator.appName; 

	if (eventType == "focus"){
		if (obj.value == obj.title){
			obj.value = "";
		}// end if


		// change password field type to password
		if (obj.title == 'contraseña'){

			if (browserName!="Microsoft Internet Explorer"){

				obj.type = 'password';

			}// end if browser check
			else{
				// do ie text change to password for ie
				
				if (id == "password2"){
				//password_field = document.elements('user[password]');
				document.getElementById(id).innerHTML = "<input type=\"password\" class=\"inputField\" name=\"user[password]\" style=\"position:relative;z-index-500;\" title=\"contraseña\" value=\"\" onblur=\"defaultText_sp(this, 'blur', '"+id+"')\" />";
				rightLogin.elements[1].focus();
				rightLogin.elements[1].focus();
				}
				else{

					document.getElementById(id).innerHTML = "<input type=\"password\" class=\"inputField\" name=\"password\" style=\"position:relative;z-index-500;\" title=\"contraseña\" value=\"\" onblur=\"defaultText_sp(this, 'blur', '"+id+"')\" />";
					
					pass_id = document.getElementById(id).getAttribute('id');
					rightLogin2.password.focus();
					rightLogin2.password.focus();



				}
			}// end else browser check
		} // end if

		

	}
	else{
		if (obj.value == ""){
			obj.value = obj.title;


			// change input type back to text if password is left blank
			if (obj.title == 'contraseña'){
				if (browserName!="Microsoft Internet Explorer"){
					obj.type = 'text';
				}// end if browser check
				else{
				// revert password back to input text for ie

					document.getElementById(id).innerHTML = "<input type=\"text\" class=\"inputField\" name=\"password\" stlye=\"position:relative;z-index-500;\" title=\"contraseña\" value=\"contraseña\"  onfocus=\"defaultText_sp(this, 'focus', '"+id+"')\" onblur=\"defaultText(this, 'blur', '"+id+"')\" />";

				}// end else browser check
			}// end if
			

		}// end if object value empty
	}// end else
}// defaultText function


/////////
//
// Webmail Login
//
//
////////


function eadminLogin(){

	myForm 	= document.getElementById("rightLogin");

	myForm.setAttribute("target", "_blank");

	
	//email 	= eval("myForm.user['username'].value");
	email 		= myForm.elements[0].value;
	password 	= myForm.elements[1].value;
	if (emailCheck(email) == false){
		alert("email format is incorrect");
		myForm.elements[0].focus;
	}// end if
	else if (password == ""){
		alert("password field can not be blank");
		myForm.elements[1].focus;
	}// end else if
	else if (myForm.agree.checked != true){
		alert("you must agree to the terms and conditions to proceeed");
	}
	else{
		myForm.submit();
		//document.getElementById('password1').innerHTML = "<input type=\"text\" value="password" class=\"inputField\" name=\"user[password]\" stlye=\"position:relative;z-index-500;\" title=\"password\" value=\"\" onblur=\"defaultText(this, 'blur', '"+id+"')\" />";
		myForm.elements[0].value = "";
		myForm.elements[1].value = "";
		myForm.agree.checked = false;
	}// end else
}

function webmailLogin(){

	myForm 	= document.getElementById("rightLogin2");

	myForm.setAttribute("target", "_blank");

	email 	= myForm.email.value;
	if (emailCheck(myForm.email.value) == false){
		alert("email format is incorrect");
		myForm.username.focus();
	}// end if
	else if (myForm.password.value == ""){
		alert("password field can not be blank");
		myForm.password.focus();
	}// end else if
	else{

		username 	= email.substr(0, email.indexOf('@'));
		popdomain 	= email.substr((email.indexOf('@') + 1), email.length);
		myForm.pop3hostexternal.value = popdomain;
		myForm.username.value = username;
		myForm.submit();
		
		myForm.email.value 		= "";
		myForm.password.value 	= "";

	}// end else

}// end function webmailLogin()

function checked_all(obj,form_id, checkbox_name){
	
	var myForm = document.getElementById(form_id);
	
	check_box = myForm.elements[checkbox_name];
	if (obj.checked == true){
		for (i=0; i < check_box.length; i++){
			check_box[i].checked = true;
		}// end for loop
	}
}


//////
//
// Submitting Contact
//
//
//////


function submit_contact(lan){
	var interest = '';
	var language = '';
	var myForm = document.getElementById("right_contact_form");
	
	if (typeof lan != 'undefined'){
		var language = 'sp';
	}
	if ( myForm.contact_name.value == "name*" || myForm.contact_name.value == "nombre*"){
		alert_message = (language == '') ?  "please enter your name" : "por favor ingrese su nombre";
		alert(alert_message);
		myForm.contact_name.focus();
	}
	else if ( emailCheck(myForm.contact_email.value) == false){
		alert_message = (language == '') ?  "email format is incorrect" : "correo electrónico el formato es incorrecto";
		alert(alert_message);
		myForm.contact_email.focus();
	}
	else if ( myForm.phone.value == "phone*" ||  myForm.phone.value == "teléfono*"){
		alert_message = (language == '') ?  "please enter your phone number" : "por favor, introduzca su número de teléfono";
		alert(alert_message);
		myForm.phone.focus();
	}
	else if ( myForm.comment.value == "request details" ||  myForm.comment.value == "detalles de solicitud"){
		alert_message = (language == '') ?  "please enter your request details" : "por favor ingrese su pedido detalles";
		alert(alert_message);
		myForm.comment.focus();
	}

	else {

		// special interest
		if ( (typeof(myForm.service_interest) ) != "undefined"){
		

			check_box = myForm.service_interest.length;
			for (i=0; i < check_box; i++){
				if ( myForm.service_interest[i].checked ){
						if (myForm.service_interest[i].value != "all_options"){
							interest = interest + ' <br /> ' +myForm.service_interest[i].value ;
						}

				} // end if
			}// end for loop


		}// end inner if


		new Ajax.Request('/includes/ajax.php',{method:'get',parameters: 'group=contact'+
												'&email='+myForm.contact_email.value+
												'&name='+myForm.contact_name.value+
												'&comment='+myForm.comment.value+
												'&phone='+myForm.phone.value+
												'&service='+interest+
												'&page_reference='+myForm.page_reference.value+
												'&method_type=send'+
												'&language='+language+
												'&captcha_code='+myForm.captcha_code.value,
										onSuccess: function(call_this){
				if (call_this.responseText == "successful"){
					if (language != ''){
						document.getElementById("contact_form_text_replace").innerHTML = "<p>Nos pondremos en contacto con usted con su solicitud de información.</p><p>Gracias.</p>";	
					}
					else{
						document.getElementById("contact_form_text_replace").innerHTML = "<p>We will contact you with your request information.</p><p>Thank You.</p>";
					}
					// do this;
				}
				else{
					alert(call_this.responseText);
					document.getElementById('captcha_image').src = '/captcha/securimage_show.php?sid=' + Math.random();

				}
				
			}
		}); // end Ajax.Request 


	}// end else
}

function submit_incident(){
	var phone = '';
	var interest = '';
	var myForm = document.getElementById("right_contact_form");
	
	
	if ( myForm.firstname.value == "first name*"){
		alert('please enter your first name');
		myForm.firstname.focus();
	}
	else if ( myForm.lastname.value == "last name*"){
		alert('please enter your last name');
		myForm.lastname.focus();
	}
	else if ( emailCheck(myForm.contact_email.value) == false){
		alert('email format is incorrect');
		myForm.contact_email.focus();
	}


	else {

		if  (myForm.phone.value != "phone(optional)"){
			phone = myForm.phone.value;
		}

		// special interest
		if ( (typeof(myForm.service_interest) ) != "undefined"){
		

			check_box = myForm.service_interest.length;
			for (i=0; i < check_box; i++){
				if ( myForm.service_interest[i].checked ){
						if (myForm.service_interest[i].value != "all_options"){
							interest = interest + ' <br /> ' +myForm.service_interest[i].value ;
						}

				} // end if
			}// end for loop


		}// end inner if


		new Ajax.Request('/includes/ajax.php',{method:'get',parameters: 'group=support'+
												'&email='+myForm.contact_email.value+
												'&name='+myForm.firstname.value+ ' '+myForm.lastname.value+
												'&comment='+myForm.comment.value+
												'&phone='+phone+
												'&service='+interest+
												'&page_reference='+myForm.page_reference.value+
												'&method_type=send'+
												'&captcha_code='+myForm.captcha_code.value,
										onSuccess: function(call_this){
				if (call_this.responseText == "successful"){
					document.getElementById("contact_form_text_replace").innerHTML = "<p>We will contact you with your request information.</p><p>Thank You.</p>";
					// do this;
				}
				else{
					alert(call_this.responseText);
					document.getElementById('captcha_image').src = '/captcha/securimage_show.php?sid=' + Math.random();

				}
				
			}
		}); // end Ajax.Request 


	}// end else
}


function submit_incident_sp(){
	var phone = '';
	var interest = '';
	var myForm = document.getElementById("right_contact_form");
	
	
	if ( myForm.firstname.value == "nombre*"){
		alert('Por favor, introduzca su nombre de pila.');
		myForm.firstname.focus();
	}
	else if ( myForm.lastname.value == "apellido*"){
		alert('Por favor, introduzca su apellido');
		myForm.lastname.focus();
	}
	else if ( emailCheck(myForm.contact_email.value) == false){
		alert('Por favor, introduzca el e-mail correcta.');
		myForm.contact_email.focus();
	}


	else {

		if  (myForm.phone.value != "phone(optional)"){
			phone = myForm.phone.value;
		}

		// special interest
		if ( (typeof(myForm.service_interest) ) != "undefined"){
		

			check_box = myForm.service_interest.length;
			for (i=0; i < check_box; i++){
				if ( myForm.service_interest[i].checked ){
						if (myForm.service_interest[i].value != "all_options"){
							interest = interest + ' <br /> ' +myForm.service_interest[i].value ;
						}

				} // end if
			}// end for loop


		}// end inner if


		new Ajax.Request('/includes/ajax.php',{method:'get',parameters: 'group=support'+
												'&email='+myForm.contact_email.value+
												'&name='+myForm.firstname.value+ ' '+myForm.lastname.value+
												'&comment='+myForm.comment.value+
												'&phone='+phone+
												'&service='+interest+
												'&page_reference='+myForm.page_reference.value+
												'&method_type=send'+
												'&captcha_code='+myForm.captcha_code.value,
										onSuccess: function(call_this){
				if (call_this.responseText == "successful"){
					document.getElementById("contact_form_text_replace").innerHTML = "<p>Nos pondremos en contacto con usted con su solicitud de información.</p><p>Gracias.</p>";
					// do this;
				}
				else{
					alert(call_this.responseText);
					document.getElementById('captcha_image').src = '/captcha/securimage_show.php?sid=' + Math.random();

				}
				
			}
		}); // end Ajax.Request 


	}// end else
}




function search_from_header(){
	myForm = document.getElementById("search_form");
	myForm.submit();
}
function set_target(obj, targetname){
	obj.setAttribute("target", "targetname");
	
}

function submit_reseller_app(){
	
	var checkItems	= "";
	var error = "";

	var myForm = document.getElementById("reseller_form");

	if (!(myForm.application_type[0].checked  || myForm.application_type[1].checked)){
		error += "Please select your application type.\n";
	}
	if (myForm.firstname.value == ""){
		error += "Please enter your first name.\n";
	}
	if (myForm.lastname.value == ""){
		error += "Please enter your last name.\n";
	}
	if (myForm.address.value == ""){
		error += "Please enter your address.\n";
	}
	if (myForm.city.value == ""){
		error += "Please enter your city.\n";
	}
	if (myForm.zipcode.value == ""){
		error += "Please enter your zip code.\n";
	}
	if (myForm.phone.value == ""){
		error += "Please enter your phone number.\n";
	}
	if (myForm.number_of_clients.value == ""){
		error += "Please enter the number of clients you are presently serving.\n";
	}
	if (emailCheck(myForm.email.value) == false){
		error += "Please enter the correct email.\n";
	}
	

	if (error != ""){
		alert(error);
		
	}
	else{

		applicationType = 	(myForm.application_type[0].checked) ? "Individual" : "Coporate";

		loopBox = myForm.elements["service_interest[]"];
		delimCount = 0;
		for (var i = 0; i < loopBox.length ; i++){
			if(loopBox[i].checked){
				setDelim = (delimCount != 0) ? ",\n" : "";
				checkItems += setDelim + loopBox[i].value;
				delimCount++;
			}
		}

		

		new Ajax.Request('/includes/ajax.php',{method:'get',parameters: 
			'group=reseller'+

			'&captcha_code='		+myForm.captcha_code.value+
			'&company='				+myForm.company.value+
			'&title='				+myForm.title.value+
			'&firstname='			+myForm.firstname.value+
			'&lastname='			+myForm.lastname.value+
			'&address='				+myForm.address.value+
			'&city='				+myForm.city.value+
			'&state='				+myForm.state.value+
			'&zipcode='				+myForm.zipcode.value+
			'&phone='				+myForm.phone.value+
			'&email='				+myForm.email.value+
			'&number_of_clients='	+myForm.number_of_clients.value+
			'&language=en'+
			'&application_type='	+applicationType+
			'&service='				+checkItems+
			'&page_reference='		+myForm.page_reference.value+

			'&method_type=send',
			onSuccess: function(call_this){
				if (call_this.responseText == "successful"){
					document.getElementById("contact_form_text_replace").innerHTML = "<p>We will contact you with your request information.</p><p>Thank You.</p>";
				}
				else{
					alert(call_this.responseText);
					document.getElementById('captcha_image').src = '/captcha/securimage_show.php?sid=' + Math.random();
				}
			}
		});
		//myForm.captcha_code.value 
		error += "Please enter the number of clients you are presently serving.\n";
	}
}


function submit_reseller_app_sp(){
	
	var checkItems	= "";
	var error = "";

	var myForm = document.getElementById("reseller_form");

	if (!(myForm.application_type[0].checked  || myForm.application_type[1].checked)){
		error += "Selecciona tu tipo de aplicación.\n";
	}
	if (myForm.firstname.value == ""){
		error += "Por favor, introduzca su nombre de pila.\n";
	}
	if (myForm.lastname.value == ""){
		error += "Por favor, introduzca su apellido.\n";
	}
	if (myForm.address.value == ""){
		error += "Por favor, introduzca su dirección.\n";
	}
	if (myForm.city.value == ""){
		error += "Por favor, introduzca su ciudad.\n";
	}
	if (myForm.zipcode.value == ""){
		error += "Por favor, introduzca su código postal.\n";
	}
	if (myForm.phone.value == ""){
		error += "Por favor, introduzca su número de teléfono.\n";
	}
	if (myForm.number_of_clients.value == ""){
		error += "Por favor, introduzca el número de clientes que está al servicio de.\n";
	}
	if (emailCheck(myForm.email.value) == false){
		error += "Por favor, introduzca el e-mail correcta.\n";
	}
	

	if (error != ""){
		alert(error);
		
	}
	else{

		applicationType = 	(myForm.application_type[0].checked) ? "Individual" : "Coporate";

		loopBox = myForm.elements["service_interest[]"];
		delimCount = 0;
		for (var i = 0; i < loopBox.length ; i++){
			if(loopBox[i].checked){
				setDelim = (delimCount != 0) ? ",\n" : "";
				checkItems += setDelim + loopBox[i].value;
				delimCount++;
			}
		}

		

		new Ajax.Request('/includes/ajax.php',{method:'get',parameters: 
			'group=reseller'+

			'&captcha_code='		+myForm.captcha_code.value+
			'&company='				+myForm.company.value+
			'&title='				+myForm.title.value+
			'&firstname='			+myForm.firstname.value+
			'&lastname='			+myForm.lastname.value+
			'&address='				+myForm.address.value+
			'&city='				+myForm.city.value+
			'&state='				+myForm.state.value+
			'&zipcode='				+myForm.zipcode.value+
			'&phone='				+myForm.phone.value+
			'&email='				+myForm.email.value+
			'&number_of_clients='	+myForm.number_of_clients.value+
			'&application_type='	+applicationType+
			'&service='				+checkItems+
			'&language=sp'+
			'&page_reference='		+myForm.page_reference.value+

			'&method_type=send',
			onSuccess: function(call_this){
				if (call_this.responseText == "successful"){
					document.getElementById("contact_form_text_replace").innerHTML = "<p>Nos pondremos en contacto con usted con su solicitud de información.</p><p>Gracias.</p>";
				}
				else{
					alert(call_this.responseText);
					document.getElementById('captcha_image').src = '/captcha/securimage_show.php?sid=' + Math.random();
				}
			}
		});
		//myForm.captcha_code.value 
		error += "Please enter the number of clients you are presently serving.\n";
	}
}

function submit_employment_app(){
	
	var checkItems	= "";
	var error = "";


	var myForm2 = parent.frames["uploadfile"].document.getElementById("form_attachment");
	
	var resume = myForm2.attachment.value;

	var confirm_attachment  = myForm2.attach_success.value;
	
	var myForm = document.getElementById("employment_form");

	
	if (myForm.firstname.value == ""){
		error += "Please enter your first name.\n";
	}
	if (myForm.lastname.value == ""){
		error += "Please enter your last name.\n";
	}
	if (myForm.address.value == ""){
		error += "Please enter your address.\n";
	}
	if (myForm.city.value == ""){
		error += "Please enter your city.\n";
	}
	if (myForm.zipcode.value == ""){
		error += "Please enter your zip code.\n";
	}
	if (emailCheck(myForm.email.value) == false){
		error += "Please enter the correct email.\n";
	}
	if (resume  == "" || confirm_attachment == "0"){
		error += "A resume is required for the posted position.\n";
	}
	
	if (error != ""){
		alert(error);
	}
	else{
			
		loopBox = myForm.elements["service_interest[]"];
		delimCount = 0;
		for (var i = 0; i < loopBox.length ; i++){
			if(loopBox[i].checked){
				setDelim = (delimCount != 0) ? ",\n" : "";
				checkItems += setDelim + loopBox[i].value;
				delimCount++;
			}
		}
		
		new Ajax.Request('/includes/ajax.php',{method:'post',parameters:{
			group:				'employment',

			captcha_code:		myForm.captcha_code.value,
			firstname:			myForm.firstname.value,
			lastname:			myForm.lastname.value,
			address:			myForm.address.value,
			city:				myForm.city.value,
			state:				myForm.state.value,
			zipcode:			myForm.zipcode.value,
			email:				myForm.email.value,
			availability:		myForm.availability.value,
			service:			checkItems,
			page_reference:		myForm.page_reference.value,
			language:			'en',

			method_type:		'send'},
			onSuccess: function(call_this){
				if (call_this.responseText == "successful"){
					document.getElementById("contact_form_text_replace").innerHTML = "<p>Your application will be kept on file.</p><p>Thank You.</p>";
				}
				else{
					alert(call_this.responseText);
					document.getElementById('captcha_image').src = '/captcha/securimage_show.php?sid=' + Math.random();
				}
			}
		});
		//myForm.captcha_code.value 

		
		
		
	}

	
}


function submit_employment_app_sp(){
	
	var checkItems	= "";
	var error = "";


	var myForm = document.getElementById("employment_form");

	
	if (myForm.firstname.value == ""){
		error += "Por favor, introduzca su nombre de pila.\n";
	}
	if (myForm.lastname.value == ""){
		error += "Por favor, introduzca su apellido.\n";
	}
	if (myForm.address.value == ""){
		error += "Por favor, introduzca su dirección.\n";
	}
	if (myForm.city.value == ""){
		error += "Por favor, introduzca su ciudad.\n";
	}
	if (myForm.zipcode.value == ""){
		error += "Por favor, introduzca su código postal.\n";
	}
	if (emailCheck(myForm.email.value) == false){
		error += "Por favor, introduzca el e-mail correcta.\n";
	}
	
	if (error != ""){
		alert(error);
	}
	else{
			
		loopBox = myForm.elements["service_interest[]"];
		delimCount = 0;
		for (var i = 0; i < loopBox.length ; i++){
			if(loopBox[i].checked){
				setDelim = (delimCount != 0) ? ",\n" : "";
				checkItems += setDelim + loopBox[i].value;
				delimCount++;
			}
		}
		
		new Ajax.Request('/includes/ajax.php',{method:'post',parameters:{
			group:				'employment',

			captcha_code:		myForm.captcha_code.value,
			firstname:			myForm.firstname.value,
			lastname:			myForm.lastname.value,
			address:			myForm.address.value,
			city:				myForm.city.value,
			state:				myForm.state.value,
			zipcode:			myForm.zipcode.value,
			email:				myForm.email.value,
			availability:		myForm.availability.value,
			service:			checkItems,
			page_reference:		myForm.page_reference.value,
			language:			'en',

			method_type:		'send'},
			onSuccess: function(call_this){
				if (call_this.responseText == "successful"){
					document.getElementById("contact_form_text_replace").innerHTML = "<p>Su solicitud se mantendrá en archivo.</p><p>Gracias.</p>";
				}
				else{
					alert('Captcha inválida');
					document.getElementById('captcha_image').src = '/captcha/securimage_show.php?sid=' + Math.random();
				}
			}
		});
		//myForm.captcha_code.value 

		
		
		
	}

	
}


function show_testimonials(obj){
	document.getElementById("info_data").style.display = "none";
	document.getElementById("testimonial_data").style.display = "block";
	
	document.getElementById("data_link").style.color = "#999999";
	document.getElementById("test_link").style.color = "#666666";
	

	document.getElementById("image_data").src = '/assets/images/show_inactive_circles.png';
	document.getElementById("image_test").src = '/assets/images/show_active_circles.png';
	
}

function show_info(){
	document.getElementById("info_data").style.display = "block";
	document.getElementById("testimonial_data").style.display = "none";

	document.getElementById("data_link").style.color = "#666666";
	document.getElementById("test_link").style.color = "#999999";

	document.getElementById("image_data").src = '/assets/images/show_active_circles.png';
	document.getElementById("image_test").src = '/assets/images/show_inactive_circles.png';
}


function domain_check(domain, lan){
	url = "/assets/dtd/checkDomainAPI.php";

	domain_status = "NotAvailable";

	new Ajax.Request(url, {method:'post', parameters:{
			domain:		domain
		},
		onSuccess: function (call_this){

			//var xmlData = new ActiveXObject("Microsoft.XMLDOM");

			xmlData = call_this.responseXML;

			//alert(xmlData.getElementsByTagName("Body").length);

			body_tag = xmlData.getElementsByTagName("Body")[0];

			
			
			for (i = 0; i < xmlData.getElementsByTagName("Body")[0].childNodes.length; i++){
				if(xmlData.getElementsByTagName("Body")[0].childNodes[i].tagName == "Available"){
					domain_status = "Available";
					break;
				}
				else if(xmlData.getElementsByTagName("Body")[0].childNodes[i].tagName == "Invalid"){
					domain_status = "Invalid";
					break;
				}
				
			}// end for loop

			if(domain_status == "Available"){
				if (typeof lan != 'undefined'){
					document.getElementById("domain_replace_text").innerHTML = "<div class=\"domain_valid\">Felicidades! <span class=\"smallfont12\">El dominio que ha seleccionado está disponible. Para garantizar este dominio, póngase en contacto con NetPass en 888.296.7277. <strong>COMING PRONTO</strong> ... inmediato registro de dominio aquí en search <a href=\"/\">www.netpass.com</a>.  Vuelve a menudo para obtener más detalles.</span></div>";
				}else{
					document.getElementById("domain_replace_text").innerHTML = "<div class=\"domain_valid\">Congratulations! <span class=\"smallfont12\">The domain you've selected is available. To secure this domain, please contact NetPass at 888.296.7277. <strong>COMING SOON</strong>... online domain registration right here at <a href=\"/\">www.netpass.com</a>.  Check back often for details.</span></div>";
				}
			}
			else if(domain_status == "Invalid"){
				if (typeof lan != 'undefined'){
					document.getElementById("domain_replace_text").innerHTML = "<div class=\"domain_invalid\">dominio no es válido</div>";

				}else{
					document.getElementById("domain_replace_text").innerHTML = "<div class=\"domain_invalid\">domain is invalid</div>";
				}
			}
			else{
				if (typeof lan != 'undefined'){
					document.getElementById("domain_replace_text").innerHTML = "<div class=\"domain_invalid\">dominio no disponible</div>";

				}else{
					document.getElementById("domain_replace_text").innerHTML = "<div class=\"domain_invalid\">domain not available</div>";
				}
			}

		}
		
	});

	focusme = document.getElementById("domain_input");
	focusme.focus();

}
function round_number(number, position){

	var result = Math.round(number * Math.pow(10,position)) / Math.pow(10,position);


	return result;
}

function update_payment_term(price, textvalue){

	price = parseFloat(price);

	document.getElementById("show_hosting_price").innerHTML	= price.toFixed(2);
	document.getElementById("show_hosting_text").innerHTML 	= textvalue;

	
	domain_price = document.getElementById("show_domain_price").innerHTML;
	
	total_amount = price + parseFloat(domain_price);

	document.getElementById("show_total_amount").innerHTML = total_amount.toFixed(2);

}

function new_window(url, name, attrib){
	if (typeof(attrib) == "undefined"){
		attrib = "toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1";
	}
	window.open(url, name, attrib);

}
function close_banner(){
	document.getElementById("new_banner_announcement").style.display = "none";
	
	new Ajax.Request('/includes/ajax.php',{
		method:'get',parameters: 
			'group=banner'+
			'&method_type=disable',

			onSuccess: function(call_this){
				//alert(call_this.responseText);
			}
	});
}
			
function upload_attachment(id){
	myForm = document.getElementById(id);
	myForm.submit();
}
function show_eadmin_lightbox(display){

	if (display == "show"){
		document.getElementById("black_box_container").style.display = "block";
		document.getElementById("lightbox_container").style.display = "block";
		document.getElementById("terms_lightbox").style.display = "block";
		
	}
	else{
		document.getElementById("black_box_container").style.display = "none";
		document.getElementById("lightbox_container").style.display = "none";
		document.getElementById("terms_lightbox").style.display = "none";
	}
	
}
function webmail_help(){
	new_window('http://webmail.netpass.com/parse.php?file=html/$this->Language/help/filexp.html&FirstLoad=1&HelpFile=loginhelp.html','webmail_popup','width=800,height=600');
}

function open_christmas_game(){
	new_window('/christmas09.php', 'christmas_game', 'width=640', 'height=50')
	//window.open('/christmas09.php','FeastorFamine','width=640,height=600'); return false;
}

function hide_div(id){
	document.getElementById(id).style.display = 'none';
}
function swap_image(id, image_path){
	document.getElementById(id).src=image_path;
}
/*** PRELOAD PICTURES FOR EMAIL ADMIN AND WEBMAIL LOGIN BUTTONS ***/
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
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];}
}
