/*
 * GoMidjets JS Functions File
 * Copyright (C) GoMidjets Ltd.
 * www.GoMidjets.com
 */




/*
 * Price Calculation
 */
function CalculatePriceOrig(int1,int2)
{
        //alert('calc ' + int)
		// The next line executes the php and sends the 'k' as paramater . 'data' is the return value from the php;
        $.post("js/ajax_calc_price.php", { k: int1, j: int2 },
  		function(data){
		    //alert('data ->' + data);
			
		data = data.split('||');
		//data[0] is price
		//data[1] is md5 code
		//data[2] is VOBs quantity
		//data[3] is years
		//data[4] is original price
		//data[5] is discount description
						
//      document.getElementById('goPrice').innerHTML = 'Price is USD $' + data[0] +'<br /> <a target="_blank" href="https://www.plimus.com/jsp/buynow.jsp?contractId=2278070&overridePrice=' + data[0] + '&bCur=USD&opp=' + data[1] + '">Click here to purchase</a>';
		// link should be:https://www.plimus.com/jsp/buynow.jsp?contractId=2278070&overridePrice=<data>&bCur=USD&opp=<m5dValue>
		
		//alert('data4->'+data[4]);
		if (!is_null(data[4]))
		{
			// Discount!
			myDiscount = data[4] - data[0];
			myDiscount = myDiscount.toFixed(2);
			//document.getElementById('goPrice').innerHTML = 'Licensing cost for ' + data[2] + ' VOBs for ' + data[3] + ' year(s)	 is: USD $ ' + data[4] + ' &nbsp; <br /><strong>But wait! You are getting a discount!</strong><br /> Original Price: USD $<del>' + data[4] + '</del><br /> You Pay: USD $'+ data[0] + '<br /> <font color="blue">You Save: USD $' + myDiscount + ' (' + data[5] + ') </font><a onclick="tSendMail(' + data[2] + ',' + data[3] + ');" target="_blank" href="https://www.plimus.com/jsp/buynow.jsp?contractId=2278070&overridePrice=' + data[0] + '&bCur=USD&opp=' + data[1] + '"><img src="images/btn_buy.jpg"></a>';
			document.getElementById('goPrice').innerHTML = 'Licensing cost for ' + data[2] + ' VOBs for ' + data[3] + ' years	 is: USD $ ' + data[4] + ' &nbsp; <br /> List Price: USD $<del>' + data[4] + '</del><br /> Price: USD $'+ data[0] + '<br /> <font color="blue">You Save: USD $' + myDiscount + ' (' + data[5] + ') </font><a onclick="tSendMail(' + data[2] + ',' + data[3] + ');" target="_blank" href="https://www.plimus.com/jsp/buynow.jsp?contractId=2278070&overridePrice=' + data[0] + '&bCur=USD&opp=' + data[1] + '"><img src="images/btn_buy.jpg"></a>';
			
		}
		else
		{
			// Link
			document.getElementById('goPrice').innerHTML = 'Licensing cost for ' + data[2] + ' VOBs for ' + data[3] + ' year	 is: USD $' + data[0] + ' &nbsp; &nbsp; &nbsp; &nbsp; <a onclick="tSendMail(' + data[2] + ',' + data[3] + ');" target="_blank" href="https://www.plimus.com/jsp/buynow.jsp?contractId=2278070&overridePrice=' + data[0] + '&bCur=USD&opp=' + data[1] + '"><img src="images/btn_buy.jpg"></a>';
		}
        MM_changeProp('goPrice','','display','block','DIV')
        MM_effectAppearFade('goPrice', 1000, 0, 100, false)
  });

}

/*
 * Price Calculation
 */
function CalculatePrice(int1,int2)
{
        //alert('calc ' + int)
		// The next line executes the php and sends the 'k' as paramater . 'data' is the return value from the php;
        $.post("js/ajax_calc_price.php", { k: int1, j: int2 },
  		function(data){
		    //alert('data ->' + data);
			
		data = data.split('||');
		//data[0] is price
		//data[1] is md5 code
		//data[2] is VOBs quantity
		//data[3] is no. of VOBs server
		//data[4] is original price
		//data[5] is discount description
						
//      document.getElementById('goPrice').innerHTML = 'Price is USD $' + data[0] +'<br /> <a target="_blank" href="https://www.plimus.com/jsp/buynow.jsp?contractId=2278070&overridePrice=' + data[0] + '&bCur=USD&opp=' + data[1] + '">Click here to purchase</a>';
		// link should be:https://www.plimus.com/jsp/buynow.jsp?contractId=2278070&overridePrice=<data>&bCur=USD&opp=<m5dValue>
		
		//alert('data4->'+data[4]);
		if (!is_null(data[4]))
		{
			// Discount!
			myDiscount = data[4] - data[0];
			myDiscount = myDiscount.toFixed(2);
			//document.getElementById('goPrice').innerHTML = 'Licensing cost for ' + data[2] + ' VOBs for ' + data[3] + ' year(s)	 is: USD $ ' + data[4] + ' &nbsp; <br /><strong>But wait! You are getting a discount!</strong><br /> Original Price: USD $<del>' + data[4] + '</del><br /> You Pay: USD $'+ data[0] + '<br /> <font color="blue">You Save: USD $' + myDiscount + ' (' + data[5] + ') </font><a onclick="tSendMail(' + data[2] + ',' + data[3] + ');" target="_blank" href="https://www.plimus.com/jsp/buynow.jsp?contractId=2278070&overridePrice=' + data[0] + '&bCur=USD&opp=' + data[1] + '"><img src="images/btn_buy.jpg"></a>';
			//document.getElementById('goPrice').innerHTML = 'Licensing cost for ' + data[2] + ' VOBs for ' + data[3] + ' years	 is: USD $ ' + data[4] + ' &nbsp; <br /> List Price: USD $<del>' + data[4] + '</del><br /> Price: USD $'+ data[0] + '<br /> <font color="blue">You Save: USD $' + myDiscount + ' (' + data[5] + ') </font><a onclick="tSendMail(' + data[2] + ',' + data[3] + ');" target="_blank" href="https://www.plimus.com/jsp/buynow.jsp?contractId=2278070&overridePrice=' + data[0] + '&bCur=USD&opp=' + data[1] + '"><img src="images/btn_buy.jpg"></a>';
			document.getElementById('goPrice').innerHTML = 'Licensing cost for ' + data[2] + ' VOBs with ' + data[3] + ' VOB servers is: USD $ ' + data[4] + ' &nbsp; <br /> List Price: USD $<del>' + data[4] + '</del><br /> Price: USD $'+ data[0] + '<br /> <font color="blue">You Save: USD $' + myDiscount + ' (' + data[5] + ') </font><a onclick="tSendMail(' + data[2] + ',' + data[3] + ');" target="_blank" href="https://www.plimus.com/jsp/buynow.jsp?contractId=2278070&overridePrice=' + data[0] + '&bCur=USD&opp=' + data[1] + '"><img src="images/btn_buy.jpg"></a>';
			
		}
		else
		{
			// Link
			document.getElementById('goPrice').innerHTML = 'Licensing cost for ' + data[2] + ' VOBs with ' + data[3] + ' VOB servers is: USD $' + data[0] + ' &nbsp; &nbsp; &nbsp; &nbsp; <a onclick="tSendMail(' + data[2] + ',' + data[3] + ');" target="_blank" href="https://www.plimus.com/jsp/buynow.jsp?contractId=2278070&overridePrice=' + data[0] + '&bCur=USD&opp=' + data[1] + '"><img src="images/btn_buy.jpg"></a>';
		}
        MM_changeProp('goPrice','','display','block','DIV')
        MM_effectAppearFade('goPrice', 1000, 0, 100, false)
  });

}

/*
 * Send Email
 */
function tSendMail(vob,years)
{
	$.post("js/ajax_calc_price.php", { a: 'dom', b: vob, c: years },
	function(data){
		//alert('data->'+data);
  	});
		
}

<!--
function MM_changeProp(objId,x,theProp,theValue) { //v9.0
  var obj = null; with (document){ if (getElementById)
  obj = getElementById(objId); }
  if (obj){
    if (theValue == true || theValue == false)
      eval("obj.style."+theProp+"="+theValue);
    else eval("obj.style."+theProp+"='"+theValue+"'");
  }
}
//-->

function MM_effectAppearFade(targetElement, duration, from, to, toggle)
{
        Spry.Effect.DoFade(targetElement, {duration: duration, from: from, to: to, toggle: toggle});
}



/*
 * Integer Only
 */
function checkIt(evt) 
{
    evt = (evt) ? evt : window.event
    var charCode = (evt.which) ? evt.which : evt.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        status = "This field accepts numbers only."
        return false
    }
    status = ""
    return true;
}

/*
 * Check for null vars
 */
function is_null(myVar)
{
	if (myVar == "" || myVar == null || myVar.charAt(0) == ' ')
	{
		return true;
	}
	else
	{
		return false;
	}
	
}



/*
 * Email Validation
 */
function isValidEmail(strEmail) {
validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	if (strEmail.search(validRegExp) == -1) {return false;} 
	return true;
}


/*
 * Quick Contact Validation
 */
function GoMidjets_QuickContact_Form_Validate()
{
	// Get Vars
	name = document.GoMidjets_QuickContact_Form.qcontact_name.value;
	company = document.GoMidjets_QuickContact_Form.qcontact_company.value;
	email = document.GoMidjets_QuickContact_Form.qcontact_email.value;
	phone = document.GoMidjets_QuickContact_Form.qcontact_phone.value;
	message = document.GoMidjets_QuickContact_Form.qcontact_comments.value;
	
	// Name
	if (is_null(name))
	{
		alert('You must fill in your name');
		document.GoMidjets_QuickContact_Form.qcontact_name.focus();
		return false;
	}

	// Company
	if (is_null(company))
	{
		alert('You must fill in your company name');
		document.GoMidjets_QuickContact_Form.qcontact_company.focus();
		return false;
	}

	// Email
	if (is_null(email))
	{
		alert('You must fill in your email address');
		document.GoMidjets_QuickContact_Form.qcontact_email.focus();
		return false;
	}

	// Email Validation
	if (!isValidEmail(email))
	{
		alert('Invalid E-mail. please fill in correct one.');
		document.GoMidjets_QuickContact_Form.qcontact_email.focus();
		return false;		
	}
	
	// Phone
	if (is_null(phone))
	{
		alert('You must fill in your phone number');
		document.GoMidjets_QuickContact_Form.qcontact_phone.focus();
		return false;
	}
	
	// Submit
        $.post("js/ajax_quick_contact.php", { l: name, i: company, o: email, r: phone, g: message},
  		function(data){
			//alert('data->'+data)
			if (data == '1')
			{
				// Remove Contact Form
				MM_effectAppearFade('store_quick_contact', 1000, 100, 0, false);
				window.setTimeout("MM_changeProp('store_quick_contact','','display','none','DIV')",1000);
	
				// Show Thank You
				window.setTimeout("MM_effectAppearFade('store_quick_contact_thankyou', 1000, 0, 100, false)	",1200);
				window.setTimeout("MM_changeProp('store_quick_contact_thankyou','','display','block','DIV')",2200); // Just incase...	
		    
			}
		  });	
		
}

/*
 * Registration Validation
 */

function GoMidjets_Registration_Form_Validate()
{

	// Get Vars
	txt_fname = document.frm_GoMidjetsRegister.txt_fname.value;
	txt_lname = document.frm_GoMidjetsRegister.txt_lname.value;
	txt_email = document.frm_GoMidjetsRegister.txt_email.value;
    txt_company = document.frm_GoMidjetsRegister.txt_company.value;
    txt_position = document.frm_GoMidjetsRegister.combo_position.value;
    country = document.frm_GoMidjetsRegister.combo_country.value;
    phone1 = document.frm_GoMidjetsRegister.txt_phone1.value;
    phone2 = document.frm_GoMidjetsRegister.txt_phone2.value;
	txt_password = document.frm_GoMidjetsRegister.txt_password.value;
	txt_password2 = document.frm_GoMidjetsRegister.txt_password2.value;
    txt_refer = document.frm_GoMidjetsRegister.combo_refer.value;
	sec_code = document.frm_GoMidjetsRegister.txt_sec_code.value;
	
	// First Name
	if (is_null(txt_fname))
	{
		alert('You must fill in your first name');
		document.frm_GoMidjetsRegister.txt_fname.focus();
		return false;
	}

	// Last Name
	if (is_null(txt_lname))
	{
		alert('You must fill in your last name');
		document.frm_GoMidjetsRegister.txt_lname.focus();
		return false;
	}

	// Email
	if (is_null(txt_email))
	{
		alert('You must fill in your email address');
		document.frm_GoMidjetsRegister.txt_email.focus();
		return false;
	}

	// Email Validation
	if (!isValidEmail(txt_email))
	{
		alert('Invalid E-mail. please fill in correct one.');
		document.frm_GoMidjetsRegister.txt_email.focus();
		return false;		
	}

	// Password1
	if (is_null(txt_password))
	{
		alert('You must fill in your password');
		document.frm_GoMidjetsRegister.txt_password.focus();
		return false;
	}	
	
	// Password2
	if (is_null(txt_password2))
	{
		alert('You must fill in your password again');
		document.frm_GoMidjetsRegister.txt_password2.focus();
		return false;
	}
	
	// Password1 Vs. Password2
	if (txt_password != txt_password2)
	{
		alert('Your Passwords does not match. please retype.');
		document.frm_GoMidjetsRegister.txt_password.focus();
		return false;
	}


    // Company
    if (is_null(txt_company))
    {
		alert('You must fill in your company name');
		document.frm_GoMidjetsRegister.txt_company.focus();
		return false;  
    }
    
    // Position
    if (is_null(txt_position))
    {
		alert('You must fill in your position');
		document.frm_GoMidjetsRegister.combo_position.focus();
		return false;  
    }
    
    // Country
    if (is_null(country))
    {
		alert('You must select a country');
		document.frm_GoMidjetsRegister.combo_country.focus();
		return false;  
    }
    
    // phone country code
    if (is_null(phone1))
    {
		alert('Please provide your phone country code');
		document.frm_GoMidjetsRegister.txt_phone1.focus();
		return false;  
    }
    
    // phone
    if (is_null(phone2))
    {
		alert('You must fill in your phone number');
		document.frm_GoMidjetsRegister.txt_phone2.focus();
		return false;  
    }
    
    // Refer
    if (is_null(txt_refer))
    {
		alert('Please let us know how you heard about us');
		document.frm_GoMidjetsRegister.combo_refer.focus();
		return false;  
    }

	// Security Code
	if (is_null(sec_code))
	{
		alert('You must fill in a security code');
		document.frm_GoMidjetsRegister.txt_sec_code.focus();
		return false;
	}	
	
	return true;
	/*submit*/
	//document.frm_GoMidjetsRegister.submit();		

}


/*
 * Price Quote Form Validation
 */

function GoMidjets_GetQuote_Form_Validate()
{

	// Get Vars
	txt_name = document.frm_GoMidjetsQuote.txt_name.value;
	txt_company = document.frm_GoMidjetsQuote.txt_company.value;
	txt_email = document.frm_GoMidjetsQuote.txt_email.value;
	txt_phone = document.frm_GoMidjetsQuote.txt_phone.value;

	
	// First Name
	if (is_null(txt_name))
	{
		alert('You must fill in your name');
		document.frm_GoMidjetsQuote.txt_name.focus();
		return false;
	}

	// Company
	if (is_null(txt_company))
	{
		alert('You must fill in your company name');
		document.frm_GoMidjetsQuote.txt_company.focus();
		return false;
	}

	// Email
	if (is_null(txt_email))
	{
		alert('You must fill in your email address');
		document.frm_GoMidjetsQuote.txt_email.focus();
		return false;
	}

	// Email Validation
	if (!isValidEmail(txt_email))
	{
		alert('Invalid E-mail. please fill in correct one.');
		document.frm_GoMidjetsQuote.txt_email.focus();
		return false;		
	}

	// Phone
	if (is_null(txt_phone))
	{
		alert('You must fill in your phone number');
		document.frm_GoMidjetsQuote.txt_phone.focus();
		return false;
	}

	
	// Security Code
//	if (is_null(sec_code))
//	{
//		alert('You must fill in a security code');
//		document.frm_GoMidjetsRegister.txt_sec_code.focus();
//		return false;
//	}	
	
	return true;
	/*submit*/
	//document.frm_GoMidjetsRegister.submit();		

}


/* Form Validate - Registration */
/*
function GoMidjets_Registration_Form_Validate(formobj){
	
	// Enter name of mandatory fields
	var fieldRequired = Array("txt_fname", "txt_lname", "txt_email","txt_password","txt_password2","sec_code",);
	// Enter field description to appear in the dialog box
	var fieldDescription = Array("First Name", "Last Name", "E-Mail","Password","Password Verification","Security Code");
	
	// dialog message
	var alertMsg = "You must provide the following details:\n";

	var l_Msg = alertMsg.length;

	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
			if (obj.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}
*/




function GoMidjets_PasswordRecovery_Form_Validate()
{
	// Get Vars
	txt_email = document.frm_GoMidjetsPasswordRecovery.txt_email.value;
	sec_code = document.frm_GoMidjetsPasswordRecovery.txt_sec_code.value;
	
	// Email
	if (is_null(txt_email))
	{
		alert('You must fill in your email');
		document.frm_GoMidjetsPasswordRecovery.txt_email.focus();
		return false;
	}
	
	// Email Validation
	if (!isValidEmail(txt_email))
	{
		alert('Invalid E-mail. please fill in correct one.');
		document.frm_GoMidjetsPasswordRecovery.txt_email.focus();
		return false;		
	}
	
	// Security Code
	if (is_null(sec_code))
	{
		alert('You must fill in a security code');
		document.frm_GoMidjetsPasswordRecovery.txt_sec_code.focus();
		return false;
	}		

	/*submit*/
	document.frm_GoMidjetsPasswordRecovery.submit();	
}


function GoMidjets_PasswordChange_Form_Validate()
{
	// Get Vars
	txt_password = document.frm_GoMidjetsPasswordChange.txt_password.value;
	txt_password2 = document.frm_GoMidjetsPasswordChange.txt_password2.value;
	
	// Password1
	if (is_null(txt_password))
	{
		alert('You must fill in your password');
		document.frm_GoMidjetsPasswordChange.txt_password.focus();
		return false;
	}	
	
	// Password2
	if (is_null(txt_password2))
	{
		alert('You must fill in your password again');
		document.frm_GoMidjetsPasswordChange.txt_password2.focus();
		return false;
	}
	
	// Password1 Vs. Password2
	if (txt_password != txt_password2)
	{
		alert('Your Passwords does not match. please retype.');
		document.frm_GoMidjetsPasswordChange.txt_password.focus();
		return false;
	}		
	

	/*submit*/
	document.frm_GoMidjetsPasswordChange.submit();		
}






// Validate Login
function GoMidjets_Login_Form_Validate()
{

	// Get Vars
	txt_email = document.frm_GoMidjetsLogin.txt_email.value;
	txt_password = document.frm_GoMidjetsLogin.txt_password.value;
	
	// Email
	if (is_null(txt_email))
	{
		alert('You must fill in your email');
		document.frm_GoMidjetsLogin.txt_email.focus();
		return false;
	}	
	// Email Validation
	if (!isValidEmail(txt_email))
	{
		alert('Invalid E-mail. please fill in correct one.');
		document.frm_GoMidjetsLogin.txt_email.focus();
		return false;		
	}
		
	// Password
	if (is_null(txt_password))
	{
		alert('Please fill in your password');
		document.frm_GoMidjetsLogin.txt_password.focus();
		return false;
	}	
	

	/*submit*/
	//document.frm_GoMidjetsLogin.submit();
			
}

// Show USA States
function show_usa_states()
{
    sel_val = $('#combo_country').val();
    if (sel_val == 'United States')
    {
        $('#row_usa_states').show('fast');
    }
    else
    {
       $('#row_usa_states').hide('fast'); 
    }
}

// Show User Input For Position
function show_user_input_position()
{
    sel_val = $('#combo_position').val();
    if (sel_val == 'Other')
    {
        $('#row_position_user_input').show('fast');
    }
    else
    {
       $('#row_position_user_input').hide('fast'); 
    }
    
}

// Show User Input For Refer
function show_user_input_refer()
{
    sel_val = $('#combo_refer').val();
    if (sel_val == 'Other')
    {
        $('#row_refer_user_input').show('fast');
    }
    else
    {
       $('#row_refer_user_input').hide('fast'); 
    }
    
}



function edit_details_toggle_country_combo(flag)
{
    if (flag == '1')
    {
        // show combo
        $('#country_combo_wrap').show('fast');
    }
    else
    {
        // hide combo
        $('#country_combo_wrap').hide('fast');
    }
    
}


function edit_details_toggle_passwords(flag)
{
    if (flag == '1')
    {
        // show 
        $('#password1_update_wrap').show('fast');
        $('#password2_update_wrap').show('fast');
        
        // switch links
        $('#pass_update_link').hide('fast');
         $('#pass_noupdate_link').show('fast');
         
         
        
        
    }
    else
    {
        // hide 
        $('#password1_update_wrap').hide('fast');
        $('#password2_update_wrap').hide('fast');
        
        // switch links
         $('#pass_noupdate_link').hide('fast');
         $('#pass_update_link').show('fast');
         
         // reset values
         $('#txt_password').val("");
         $('#txt_password2').val("");
         
    } 
}

// Register innovate validation
function GoMidjets_RegisterInnovate_Form_Validate()
{
	// Get Vars
	txt_name = $('#txt_name').val();
    txt_position = $('#txt_position').val();
    txt_company = $('#txt_company').val();
    txt_email = $('#txt_email').val();
    txt_phone = $('#txt_phone').val();
    txt_address = $('#txt_address').val();
	
	// Name
	if (is_null(txt_name))
	{
		alert('You must fill in your name');
		$('#txt_name').focus();
		return false;
	}
    
	// Position
	if (is_null(txt_position))
	{
		alert('You must fill in your position');
		$('#txt_position').focus();
		return false;
	}
    
	// Company
	if (is_null(txt_company))
	{
		alert('You must fill in your company');
		$('#txt_company').focus();
		return false;
	} 
    
	// Email
	if (is_null(txt_email))
	{
		alert('You must fill in your email');
		$('#txt_email').focus();
		return false;
	}
	
	// Email Validation
	if (!isValidEmail(txt_email))
	{
		alert('Invalid E-mail. please fill in correct one.');
		$('#txt_email').focus();
		return false;		
	}
    
	// Phone
	if (is_null(txt_phone))
	{
		alert('You must fill in your phone');
		$('#txt_phone').focus();
		return false;
	}


	// Address
	if (is_null(txt_address))
	{
		alert('You must fill in your address');
		$('#txt_address').focus();
		return false;
	}
    
    return true;
}

// Demo Request Validation
function GoMidjets_Demo_Form_Validate()
{

	// Get Vars
	txt_name = $('#txt_name').val();
    txt_company = $('#txt_company').val();
    txt_email = $('#txt_email').val();
    txt_phone = $('#txt_phone').val();
    
	
	// Name
	if (is_null(txt_name))
	{
		alert('You must fill in your name');
		$('#txt_name').focus();
		return false;
	}
    
	// Company
	if (is_null(txt_company))
	{
		alert('You must fill in your company');
		$('#txt_company').focus();
		return false;
	} 
    
	// Email
	if (is_null(txt_email))
	{
		alert('You must fill in your email');
		$('#txt_email').focus();
		return false;
	}
	
	// Email Validation
	if (!isValidEmail(txt_email))
	{
		alert('Invalid E-mail. please fill in correct one.');
		$('#txt_email').focus();
		return false;		
	}
    
	// Phone
	if (is_null(txt_phone))
	{
		alert('You must fill in your phone');
		$('#txt_phone').focus();
		return false;
	}
    
    return true;
}


function GoMidjets_ProductActivate_Form_Validate()
{
	// Get Vars
	txt_name = $('#txt_name').val();
    txt_company = $('#txt_company').val();
    txt_email = $('#txt_email').val();
    txt_phone = $('#txt_phone').val();
    
	
	// Name
	if (is_null(txt_name))
	{
		alert('You must fill in your name');
		$('#txt_name').focus();
		return false;
	}
    
	// Company
	if (is_null(txt_company))
	{
		alert('You must fill in your company');
		$('#txt_company').focus();
		return false;
	} 
    
	// Email
	if (is_null(txt_email))
	{
		alert('You must fill in your email');
		$('#txt_email').focus();
		return false;
	}
	
	// Email Validation
	if (!isValidEmail(txt_email))
	{
		alert('Invalid E-mail. please fill in correct one.');
		$('#txt_email').focus();
		return false;		
	}
    
	// Phone
	if (is_null(txt_phone))
	{
		alert('You must fill in your phone');
		$('#txt_phone').focus();
		return false;
	}
    
    return true;
}

/*
* GoMidjets_Store_overlay_contact()
* Sends email via ajax
* Src: http://gomidjets.com/New-design-clearcheck/index-WITH-OVERLAY.php
*/
function GoMidjets_Store_overlay_contact()
{
    // Fetch Vars
    var name = $('#contact_name').val();
    var company = $('#contact_company').val();
    var email = $('#contact_email').val();
    var phone = $('#contact_phone').val();
    var msg = $('#contact_msg').val();
    
    
    // Validate
    if (!isValidEmail(email))
    {
        alert('Please enter a valid E-Mail address.');
        $('#contact_email').focus();
        return false;
    }
    
    // Submit
    $.post('../js/ajax_store_contact.php', { n: name, c: company, e: email, p: phone, m: msg }, function(data){
        
        // hide form
        $('#storecontact_form_wrap').hide();
        
        
       if (data == 1)
       {
            // success
            $('#storecontact_form_success').fadeIn();
       }
       else
       {
            // error
            $('#storecontact_form_error').fadeIn();
       }
    });
    
    
    // Finish
    
}

function GoMidjets_WhitePapers_overlay_send()
{
    // Fetch Vars
    var company = $('#whitepaper_company').val();
    var email = $('#whitepaper_email').val();
    var first_name = $('#whitepaper_firstname').val();
    var last_name = $('#whitepaper_lastname').val();
    
    
    // Validate
    if (!isValidEmail(email))
    {
        alert('Please enter a valid E-Mail address.');
        $('#whitepaper_email').focus();
        return false;
    }
    
    //
    
    // Submit
    $.post('../js/ajax_white_papers_send.php', { fn: first_name, ln: last_name, c: company, e: email }, function(data){
        
        // hide form
        $('#whitepapers_form_wrap').hide();
        
        
       if (data == 1)
       {
            // success
            $('#whitepaper_form_success').fadeIn();
       }
       else
       {
            // error
            $('#whitepaper_form_error').fadeIn();
       }
    });
    
    
    // Finish
}


