// JavaScript Document
function Order_Validation(){
	if(document.getElementById('email').value == ''){
		alert('Please enter your email address.');
		document.getElementById('email').focus();
	}else if(echeck(document.getElementById('email').value) == false){
document.getElementById('email').focus();
return false;
}else if(document.getElementById('fname').value == ''){
		alert('Please enter your full name.');
		document.getElementById('fname').focus();
	}else{
		return true;	
	}
	return false;
}

function echeck(str) {
 var at="@"
 var dot="."
 var lat=str.indexOf(at)
 var lstr=str.length
 var ldot=str.indexOf(dot)
 if (str.indexOf(at)==-1){
 alert("Invalid E-mail ID")
 return false
 }

 if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
 alert("Invalid E-mail ID")
 return false
 }

 if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
 alert("Invalid E-mail ID")
 return false
 }

 if (str.indexOf(at,(lat+1))!=-1){
 alert("Invalid E-mail ID")
 return false
 }

 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
 alert("Invalid E-mail ID")
 return false
 }

 if (str.indexOf(dot,(lat+2))==-1){
 alert("Invalid E-mail ID")
 return false
 }

 if (str.indexOf(" ")!=-1){
 alert("Invalid E-mail ID")
 return false
 }

 return true
} 
// JQUERY
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ TOP ORDER FORM FLOADING MENU++++++++++++++++++++++++++++++
jQuery(document).ready(function() {
	jQuery('#Items').selectbox();
	jQuery('a.cart-button').click(function () {		
		//Get the data from all the fields
		var name = jQuery('input[name=fname]');
		var email = jQuery('input[name=email]');
		var website = jQuery('input[name=link]');
		var pages = jQuery('input[name=pages_number]');
		var turnaround = jQuery('input[name=turnaround_lable]');
		var implementation = jQuery('input[name=implementation_lable]');
		var comments = jQuery('textarea[name=pro_details]');
		var feedback = jQuery('textarea[name=field-feedback]');
		var session_id = jQuery('input[name=session_id]');
		var total_amount = jQuery('input[name=total_amount]');
		var upfront_amount = jQuery('input[name=upfront_amount]');
		//Simple validation to make sure user entered something
		//If error found, add hightlight class to the text field
		if (name.val()=='') {
			name.addClass('hightlight');
			return false;
		} else name.removeClass('hightlight');
		
		if (email.val()=='') {
			email.addClass('hightlight');
			return false;
		}else if (email.val().indexOf('@') == -1 || email.val().indexOf('.') == -1 || email.val().indexOf(' ') >= 0) {
			email.addClass('hightlight');
			return false;
		} else email.removeClass('hightlight');
		//organize the data properly
		var data = 'name='+name.val()+'&email='+email.val()+'&website='+encodeURIComponent(website.val().replace("http://",""))+'&comments='+encodeURIComponent(comments.val())+'&turnaround='+turnaround.val()+'&implementation='+encodeURIComponent(implementation.val())+'&feedback='+encodeURIComponent(feedback.val())+'&pages='+encodeURIComponent(pages.val())+'&session_id='+session_id.val()+'&upfront='+encodeURIComponent(upfront_amount.val())+'&total='+encodeURIComponent(total_amount.val());
		//disabled all the text fields
		jQuery('#form_left h4 input[type=text], #form_left3 fieldset textarea').attr('disabled','true');
//		jQuery('.selecter').attr('disabled','true');
		//show the loading sign
		jQuery('#mycart .loading').show();
		//start the ajax
		jQuery.ajax({
			//this is the php file that processes the data and send mail
			url: "http://www.slicingpsdtohtml.com/source/process.php",	
			
			//GET method is used
			type: "get",

			//pass the data			
			data: data,		
			
			//Do not cache the page
			cache: false,
			
			//success
			success: function (html) {				
				//if process.php returned 1/true (send mail success)
				if (html !='0') {					
					//hide the form
					jQuery('#form').animate({'top' : -2000}, {queue:false, duration:500, easing: 'easeOutBounce'})				
					//show the success message
					jQuery('.done').animate({'top' : 0}, {queue:false, duration:100, easing: 'easeOutBounce'})
					jQuery('.done').html(html);
				//if process.php returned 0/false (send mail failed)
				} else alert('Sorry, unexpected error. Please try again later.');				
			}		
		});
		
		//cancel the submit button default behaviours
		return false;
	});
	
	jQuery('#call-me-button a').click(function () {		
		//Get the data from all the fields
		var intrested = jQuery('select[name=intrested]');
		var name = jQuery('input[name=txtfname]');
		var email = jQuery('input[name=txtemail]');
		var capcha = jQuery('input[name=txtverify]');
		var comments = jQuery('textarea[name=project_comments]');
		var Items_input = jQuery('input[id=Items_input]');
		var cc = jQuery('input[name=cc]');
		var ans1 = jQuery('#q_u_1_footer');
		var ans2 = jQuery('#q_u_2_footer');
		//Simple validation to make sure user entered something
		//If error found, add hightlight class to the text field
	if (intrested.val()=='') {
			Items_input.addClass('hightlight');
			return false;
		} else Items_input.removeClass('hightlight');
		if (name.val()=='') {
			name.addClass('hightlight');
			return false;
		} else name.removeClass('hightlight');
		
		if (email.val()=='') {
			email.addClass('hightlight');
			return false;
		}else if (email.val().indexOf('@') == -1 || email.val().indexOf('.') == -1 || email.val().indexOf(' ') >= 0) {
			email.addClass('hightlight');
			return false;
		} else email.removeClass('hightlight');
		if (comments.val()=='') {
			comments.addClass('hightlight');
			return false;
		}else comments.removeClass('hightlight');
		if (capcha.val() != (parseInt(ans1.html())+parseInt(ans2.html()))) {
			capcha.addClass('hightlight');
			return false;
		} else capcha.removeClass('hightlight');
		
		//organize the data properly
		var data = 'intrested=' + intrested.val() + '&name=' + name.val() + '&email=' + email.val() + '&comments='+ encodeURIComponent(comments.val())+'&cc='+ cc.val();
		
		//disabled all the text fields
		jQuery('#footer-form-main h4 input[type=text], #footer-form-main h4 textarea').attr('disabled','true');
//		jQuery('.selecter').attr('disabled','true');
		//show the loading sign
		jQuery('#call-me .loading').show();
		//start the ajax
		jQuery.ajax({
			//this is the php file that processes the data and send mail
			url: "http://www.slicingpsdtohtml.com/source/process_footer.php",	
			
			//GET method is used
			type: "get",

			//pass the data			
			data: data,		
			
			//Do not cache the page
			cache: false,
			
			//success
			success: function (html) {				
				//if process.php returned 1/true (send mail success)
				if (html !='0') {					
					//hide the form
					jQuery('#footer-form-main #footer-form-main-process').fadeOut("fast");
					//show the success message
					jQuery('.done_footer').fadeIn("slow");
					jQuery('.done_footer').html(html);
				//if process.php returned 0/false (send mail failed)
				} else alert('Sorry, unexpected error. Please try again later.');				
			}		
		});
		
		//cancel the submit button default behaviours
		return false;
	});	
	jQuery('#mid-contant-left-contact a.contact').click(function () {	
		//Get the data from all the fields
		var name = jQuery('input[name=contact_fname]');
		var email = jQuery('input[name=contact_email]');
		var capcha = jQuery('input[name=contact_verify]');
		var comments = jQuery('textarea[name=contact_comments]');
		var ans1 = jQuery('#q_u_1');
		var ans2 = jQuery('#q_u_2');
		//Simple validation to make sure user entered something
		//If error found, add hightlight class to the text field
		if (name.val()=='') {
			name.addClass('hightlight');
			return false;
		} else name.removeClass('hightlight');
		
		if (email.val()=='') {
			email.addClass('hightlight');
			return false;
		}else if (email.val().indexOf('@') == -1 || email.val().indexOf('.') == -1 || email.val().indexOf(' ') >= 0) {
			email.addClass('hightlight');
			return false;
		} else email.removeClass('hightlight');
		if (comments.val()=='') {
			comments.addClass('hightlight');
			return false;
		}else comments.removeClass('hightlight');
		if (capcha.val() != (parseInt(ans1.html())+parseInt(ans2.html()))) {
			capcha.addClass('hightlight');
			return false;
		} else capcha.removeClass('hightlight');
		
		//organize the data properly
		var data = 'name=' + name.val() + '&email=' + email.val() + '&comments='+ encodeURIComponent(comments.val());
		
		//disabled all the text fields
		jQuery('#mid-contant-left-contact h4 input[type=text], #mid-contant-left-contact h4 textarea').attr('disabled','true');
//		jQuery('.selecter').attr('disabled','true');
		//show the loading sign
		jQuery('#mid-contant-left-contact .loading').show();
		//start the ajax
		jQuery.ajax({
			//this is the php file that processes the data and send mail
			url: "http://www.slicingpsdtohtml.com/source/process_contact.php",	
			
			//GET method is used
			type: "get",

			//pass the data			
			data: data,		
			
			//Do not cache the page
			cache: false,
			
			//success
			success: function (html) {				
				//if process.php returned 1/true (send mail success)
				if (html !='0') {					
					//hide the form
					jQuery('#mid-contant-left-contact #mid-contant-left-contact-process').fadeOut("fast");
					//show the success message
					jQuery('.done_contact').fadeIn("slow");
					jQuery('.done_contact').html(html);
				//if process.php returned 0/false (send mail failed)
				} else alert('Sorry, unexpected error. Please try again later.');				
			}		
		});
		
		//cancel the submit button default behaviours
		return false;
	});	
});
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //TOP ORDER FORM FLOADING MENU++++++++++++++++++++++++++++++

		
//===========================================================START FANCY UPLOADER SCRIPT=====================
var params = { wmode: "transparent"};
swfobject.embedSWF("http://www.slicingpsdtohtml.com/orage.swf", "orange", "303", "301", "9.0.0", "http://www.slicingpsdtohtml.com/expressInstall.swf",'',params,'');