// JavaScript Document
String.prototype.isEmailAddress = function () {return /^[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+(?:\.[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+)*\@[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+(?:\.[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+)+$/.test(this)}

function check () {
	var form = document.question;
			
			captcha_value=jQuery.ajax({url: "captcha_value.php",type:"POST",data: "cid=1",async: false }).responseText;
			// do field validation
			if (form.youremail.value == "") {
				alert( "email cannot be empty" );
				form.youremail.focus();
			return false;
			}else if (!form.youremail.value.isEmailAddress()) {
				alert( "That does not appear to be a valid email address" );
				form.youremail.value='';
				form.youremail.focus();
			return false;
			}else if (form.question.value == "") {
				alert( "Text area cannot be empty" );
				form.question.focus();
			return false;
			}else if (form.captcha.value == "") {
				alert( "Please enter security code" );
				form.captcha.focus();
			return false;
			}else if(form.captcha.value != captcha_value){
				alert( "Please enter correct security code" );
				form.captcha.focus();
			return false;
			}
			

			
}
// -->
 function expandcontacts(id1,email)
  {
    
	  var cnt_obj = document.getElementById(id1);
	 if(id1=='cnt1')
	 {
	 	document.getElementById('cnt2').style.display = "none";
		document.getElementById('cnt2').innerHTML='';
		document.getElementById('cnt1').style.display = "block";
	 }
	 else
	 {
		 document.getElementById('cnt1').style.display = "none";
		 document.getElementById('cnt1').innerHTML='';
		 document.getElementById('cnt2').style.display = "block";
	 }
  document.getElementById(id1).innerHTML=email;

}

function submitorder () {
	
	var form = document.orderprocess;
	var filename = form.file.value;
	var filelength = parseInt(filename.length) - 3;
	var fileext = filename.substring(filelength,filelength + 3);
	captcha_value=jQuery.ajax({url: "captcha_value.php",type:"POST",data: "cid=2",async: false }).responseText;
	//alert(form.link.value);
			// do field validation
			if (form.email2.value == "") {
				alert( "email cannot be empty" );
				form.email2.focus();
			return false;
			}else if (!form.email2.value.isEmailAddress()) {
				alert( "That does not appear to be a valid email address" );
				form.email2.value='';
				form.email2.focus();
			return false;
			}else if (form.file.value == "") {
				alert( "please Upload only psd or zip or illustrator " );
				form.file.focus();
			return false;
			}else if(fileext.toLowerCase() != 'zip' && fileext.toLowerCase() != 'psd' && fileext.toLowerCase() != '.ai'){
				  //else if(fileext.toLowerCase() != 'zip' && fileext.toLowerCase() != 'ai'){
				alert("Only psd or zip or illustrator allowed.");
				form.file.focus();
				return false;
			 }else if (form.pages.value == "" || form.link.value == "") {
				alert( "please enter the pages or link" );
				form.link.focus();
				return false;
			}else if (form.TextArea.value == "") {
				alert( "Please Write notes" );
				form.TextArea.focus();
			return false;
			}else if (form.captcha1.value == "") {
				alert( "Please enter security code" );
				form.captcha1.focus();
			return false;
			}else if(form.captcha1.value != captcha_value){
				alert( "Please enter correct security code" );
				form.captcha1.focus();
			return false;
			}else{
			document.orderprocess.submit();	
			}
			
}




