<!--- Create package --->	
$(document).ready(function() {
    $('.chkPackage').click(function() {
		var bandwidth_value='standard';
        
		if($("#bandwidth1").is(':checked'))
		{
			bandwidth_value = $("#bandwidth1:checked").val();
			$("#selection_bandwidth").html("Standard Plan<span>(5 GB /Month)</span>");	
		}
		else if($("#bandwidth2").is(':checked'))
		{
			bandwidth_value = $("#bandwidth2:checked").val();
			$("#selection_bandwidth").html("Plus Plan<span>(10 GB /Month)</span>");		
		}
		else if($("#bandwidth3").is(':checked'))
		{
			bandwidth_value = $("#bandwidth3:checked").val();
			$("#selection_bandwidth").html("Mega Plan<span>(15 GB /Month)</span>");	
		}
		var all_pkg =$("#all_pkg").val();
		var all_pkg_name =$("#all_pkg_name").val();
		var all_pkg_arr = all_pkg.split(",");
		var all_pkg_name_arr = all_pkg_name.split(",");
		var all_pkg_arr_length = all_pkg_arr.length;
		var chk_value='';
		var check_pkg_arr = new Array();
		var status_first='';
		var status_sec='';
		var k =0;
		for(var i=0; i<all_pkg_arr_length; i++)
		{
			
			var chk_id = "pkg_"+all_pkg_arr[i];
			var chk_status_div   = "status_"+all_pkg_arr[i];
			var id = all_pkg_arr[i];
			//var chk_status= document.getElementById(chk_id).checked;
			
			var chk_status= $("#"+chk_id+"").is(':checked');
			

			if(all_pkg_name_arr[i] == "Combo/All" && chk_status== true)
			{
				var chk_value = chk_value + $("#"+chk_id+":checked").val() +",";
				//chk_value = chk_value + document.getElementById(chk_id).value +",";
				document.getElementById(chk_status_div).innerHTML = "<img src='"+site_root_dir+"images/right.jpg'>";
				status_first = "Combo/All";
			}
			else if(all_pkg_name_arr[i] == "Add Home Page"  && chk_status== true)
			{
				chk_value = chk_value + $("#"+chk_id+":checked").val() +",";
				//chk_value = chk_value + document.getElementById(chk_id).value +",";
				document.getElementById(chk_status_div).innerHTML = "<img src='"+site_root_dir+"images/right.jpg'>";
				status_sec = "Add Home Page";
			}
			else if(chk_status)
			{
				// Made array here - for take value of checked box //
				check_pkg_arr[k] = all_pkg_arr[i];
				k++;
			}
			else
			{
				// checked box will be Uncecked here //
				document.getElementById(chk_status_div).innerHTML = "<img src='"+site_root_dir+"images/cross.jpg'>";
			}
		}
		
		if(status_first == "Combo/All")
		{
			for(var j=0; j<check_pkg_arr.length; j++)
			{
				var chk_id_other = "pkg_"+check_pkg_arr[j];
				$("#"+chk_id_other+"").attr('checked', false);
				//alert("kk="+ty);
				//document.getElementById(chk_id_other).checked =false;
				var chk_status_div   = "status_"+check_pkg_arr[j];
				document.getElementById(chk_status_div).innerHTML = "<img src='"+site_root_dir+"images/cross.jpg'>";
			}
		}
		else
		{
			for(var j=0; j<check_pkg_arr.length; j++)
			{
				var chk_id_other = "pkg_"+check_pkg_arr[j];
				var chk_status_div   = "status_"+check_pkg_arr[j];
				chk_value = chk_value + $("#"+chk_id_other+":checked").val() +",";
				//chk_value = chk_value + document.getElementById(chk_id_other).value +",";
				document.getElementById(chk_status_div).innerHTML = "<img src='"+site_root_dir+"images/right.jpg'>";
			}
		}
			
		   $.ajax({
		   type: "POST",
		   url: site_root_dir + "ajax.php",
		   data: "action=Calculation&id="+chk_value+"&bandwidth="+bandwidth_value,
		   success: function(result){
			$("#results").html("$"+result);
		   }
		 });
	  });
	
});

<!-- End ---------------->
	<!-- Start Create state dropdown whenever choose country -->
$(document).ready(function() {
    $('#mem_country').change(function() {
		 var mem_country =$("#mem_country").val();
		 $.ajax({
					type: "POST",
					url: site_root_dir + "ajax.php",
					data: "action=CreateDropDownState&mem_country="+mem_country,
					success: function(result){
					$("#state_dropdown").html(result);
		   }
		 });
	});
});
<!-- End -->


var ef=0
var usercheck=true;
var emailcheck=true;
function custAlert(id,left,top)
{
ef=1
var ids
ids=document.getElementById(id)
ids.style.left=left;
ids.style.top=top;
ids.style.visibility="visible"
}
function chk()
{


 if(document.getElementById('total_amnt') && document.getElementById('total_amnt').value>10 ){
  document.getElementById('validpackage').style.visibility='hidden'; 
  document.getElementById('fname').style.visibility='hidden';
  document.getElementById('lname').style.visibility='hidden';
  document.getElementById('emailid').style.visibility='hidden';
  document.getElementById('validemail').style.visibility='hidden';
  document.getElementById('phone').style.visibility='hidden';
  document.getElementById('username').style.visibility='hidden';
  document.getElementById('validuser').style.visibility='hidden';
  document.getElementById('password').style.visibility='hidden';
  document.getElementById('validpassword').style.visibility='hidden';
  document.getElementById('confirmpassword').style.visibility='hidden';
  document.getElementById('address').style.visibility='hidden';
  document.getElementById('country').style.visibility='hidden';
  document.getElementById('state').style.visibility='hidden';
  document.getElementById('city').style.visibility='hidden';
  document.getElementById('zip').style.visibility='hidden';
   document.getElementById('terms').style.visibility='hidden';

  if(document.signupformt.mem_fname.value=="")
  { 
  document.signupformt.mem_fname.focus();
  custAlert('fname','221px','-62px');
  return false;
  }
  if(document.signupformt.mem_lname.value=="")
  { 
   custAlert('lname','221px','-62px');
  document.signupformt.mem_lname.focus(); 
  return false;
  } 
  if(document.signupformt.mem_email.value=="")
  { 
   custAlert('emailid','221px','-62px');
   document.signupformt.mem_email.focus(); 
  return false;
  } 
  if(document.signupformt.mem_email.value != "")
  { 
    if(!Is_Email(document.signupformt.mem_email.value)) {
		   custAlert('validemail','221px','-62px');
		   document.signupformt.mem_email.focus(); 
		   return false;
     }
  } 
  if(emailcheck==false)
  {
   custAlert('existemail','221px','-62px');
   document.signupformt.mem_email.focus(); 
   return false; 
  }
  if(document.signupformt.mem_phone.value == "")
  { 
		   custAlert('phone','221px','-62px');
		   document.signupformt.mem_phone.focus(); 
		   return false;
  }
  if(document.signupformt.mem_username.value == "")
  { 
		   custAlert('username','258px','-62px');
		   //document.signupformt.mem_username.focus(); 
		   return false;
  }
  if(document.signupformt.mem_username.value != "")
  {
  var strLength= document.signupformt.mem_username.value.length
  var val =document.signupformt.mem_username.value;
  var spaceindex = document.signupformt.mem_username.value.lastIndexOf(' ');
	if(strLength < 6)
	  {
		 custAlert('userlength','258px','-62px');
		 document.signupformt.mem_username.focus(); 
		 return false;
      }
   if(val.indexOf("?")!=-1 || val.indexOf("<")!=-1 || val.indexOf("!")!=-1 || val.indexOf("@")!=-1 || val.indexOf("*")!=-1 || val.indexOf('"')!=-1 || val.indexOf(">")!=-1 || val.indexOf("$")!=-1 || val.indexOf("%")!=-1 || val.indexOf(";")!=-1 || val.indexOf("#")!=-1 || val.indexOf("{")!=-1 || val.indexOf("}")!=-1 || val.indexOf("[")!=-1 || val.indexOf("]")!=-1 || val.indexOf("(")!=-1 || val.indexOf(")")!=-1 || val.indexOf("#")!=-1 || val.indexOf("=")!=-1 || val.indexOf("+")!=-1 || val.indexOf("^")!=-1 || val.indexOf(",")!=-1 || val.indexOf(".")!=-1 || val.indexOf(":")!=-1 || val.indexOf("|")!=-1 || val.indexOf("/")!=-1  || val.indexOf("~")!=-1 ||  spaceindex!='-1')
	  {
    	 custAlert('userspace','258px','-62px');
		 document.signupformt.mem_username.focus(); 
		 return false;
	  }
 }													
  if(usercheck==false)
  {
  	 custAlert('validuser','258px','-62px');
		 return false; 
  }
   if(document.signupformt.mem_password.value == "")
  { 
		   custAlert('password','258px','-62px');
		   document.signupformt.mem_password.focus(); 
		   return false;
    
  } 
  if(document.signupformt.mem_password.value != "")
  { 
     
	 if(document.signupformt.mem_password.value.length<=5 || document.signupformt.mem_password.value.length>=15){
	 custAlert('validpassword','258px','-62px');
     document.signupformt.mem_password.focus(); 
	 return false;
	 }
  } 
   if(document.signupformt.mem_password.value != document.signupformt.re_pwd.value )
  { 
	 custAlert('confirmpassword','258px','-62px');
     document.signupformt.re_pwd.focus(); 
	 return false;
	
  } 
  if(document.signupformt.mem_address.value =="" )
  { 
	 custAlert('address','210px','-62px');
     document.signupformt.mem_address.focus(); 
	 return false;
	
  }

  if(document.signupformt.mem_country.value =="" )
  { 
	 custAlert('country','210px','-62px');
     document.signupformt.mem_country.focus(); 
	 return false;
	
  } 
  if(document.signupformt.mem_state.value =="" )
  { 
	 custAlert('state','210px','-62px');
     document.signupformt.mem_state.focus(); 
	 return false;
	
  } 
   if(document.signupformt.mem_city.value =="" )
  { 
	 custAlert('city','210px','-62px');
     document.signupformt.mem_city.focus(); 
	 return false;
	
  }
  if(document.signupformt.mem_zip.value =="" )
  { 
	 custAlert('zip','210px','-62px');
     document.signupformt.mem_zip.focus(); 
	 return false;
	
  }
   if(document.signupformt.mem_terms.checked ==false )
  { 
	 custAlert('terms','20px','-55px');
	 document.signupformt.mem_terms.focus(); 
	 return false;
	
  } 

  
 }
}
function alert_user()
{
	 if(document.signupformt.mem_username.value =="")
  { 
		alert('*IMPORTANT: Username cannot be changed.\nPlease choose username carefully and review tooltip comments.');
  }
	 
}
function Is_Email(email){
	var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
	var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
	if (!(!reg1.test(email) && reg2.test(email))) return false;
	else return true;
}
<!-- check credit card info  -->
function chk_continue()
{ 
  document.getElementById('cnumber').style.visibility='hidden'; 
  document.getElementById('cvnumber').style.visibility='hidden'; 
  if(document.DoDirectPaymentForm.creditCardNumber.value =="" )
  { 
 
	 custAlert('cnumber','550px','-62px');
     document.DoDirectPaymentForm.creditCardNumber.focus(); 
	 return false;
	
  }
  if(document.DoDirectPaymentForm.cvv2Number.value =="" )
  { 
 
	 custAlert('cvnumber','470px','-62px');
     document.DoDirectPaymentForm.cvv2Number.focus(); 
	 return false;
	
  }
}
<!-- end -->
<!-- Check user exist in database -->
$(document).ready(function() {
    $('#mem_username').change(function() {
		 var mem_username =$("#mem_username").val();
		 $.ajax({
					type: "POST",
					url: site_root_dir + "ajax.php",
					data: "opt=signup&mem_username="+mem_username,
					success: function(userresult){
					if(userresult =="false"){
					 custAlert('validuser','258px','-62px');
					 usercheck=false;
					 }else  usercheck=true;
		   }
		 });
	});
});
<!-- End -->

<!-- Check email id exist in database -->
$(document).ready(function() {
    $('#mem_email').change(function() {
		 var mem_email =$("#mem_email").val();
		 $.ajax({
					type: "POST",
					url: site_root_dir + "ajax.php",
					data: "opt=validemail&mem_email="+mem_email,
					success: function(emailresult){
					if(emailresult =="false"){
					 custAlert('existemail','221px','-62px');
					 emailcheck=false;
					 }else  emailcheck=true;
		   }
		 });
	});
});
<!-- End -->
<!-- For package validation -->
  $(function(){
    $('#signupformt').bind('submit',function(){
        var serializedCheckboxes = '';
        $("input[type=checkbox]").each(function() {																									
         if($(this).attr("checked") && $(this).attr("value")!='custom' && $(this).attr("value")!='8'  && $(this).attr("value")!='') {
                serializedCheckboxes += (serializedCheckboxes != '' ? ', ' : '') + $(this).attr("value");
				
         }
		 
        });
		 chkpackage=1;
		var chkarr = serializedCheckboxes.split(",");
		var countChecked = chkarr.length;

	   if(serializedCheckboxes == '' || countChecked<1)
	   {
	  
			   document.signupformt.bandwidth1.focus(); 
			   custAlert('validpackage','150px','0px');
			  
               return false;
	   }else chkpackage=0;

    });
});
<!-- End -->
//Update about comapany ///
$(document).ready(function() {
				 $("#mem_design").click(function () {
				 var chkvalue = $("#mem_design").attr("checked");
				 if(chkvalue)
				 	$("#customdesignregid").show("slow");
				 else
				 	$("#customdesignregid").hide("slow");
					
					
				 }
				
				 ); 

});

/// This is for login ###
$(document).ready(function() {
    $('#loginme').click(function() {
		var user =$("#user").val();
		var pass =$("#pass").val();
		var cook =$("#txtcookies").attr('checked');
		var cookvalue = '';
		if(cook)
			cookvalue = 'yes';
		else
			cookvalue = 'no';
		if(user =='')
		{
			document.getElementById('errlogin').innerHTML="Username can not be blank"; 
			document.logincheck.user.focus(); 
			return false;
		}
		else if(pass =='')
		{
			document.getElementById('errlogin').innerHTML="Password can not be blank"; 
			document.logincheck.pass.focus(); 
			 return false;
		}
		else
		{
			 $.ajax({
						type: "POST",
						url: site_root_dir + "ajax.php",
						data: "opt=loginchk&user="+user+"&pass="+pass+"&cooks="+cookvalue,
						success: function(loginresult){
						if(loginresult=='true')
							window.location.href = root_url_dir+"siteadmin/"; 
						else
						{
							document.getElementById('errlogin').innerHTML="Invalid Username or Password";
							document.logincheck.pass.focus();  
							return false;
						}
						
			   }
			 });
		 }
	});
});
/// End //

/// This is for faq ###
$(document).ready(function() {
    $('#qns').click(function() {
		alert("sdfdsf");
		
	});
});

function openclose(id)
{
	
	var qns_num_arr = document.getElementById('qns_num_arr').value;
	var my_arry = qns_num_arr.split(",");
	var num =my_arry.length;
	for(var i=0;i<num;i++)
	{
		var qns_id = "qns_id_"+my_arry[i];
		var ans_id = "ans_id_"+my_arry[i];
		if(id==qns_id)
		{
			document.getElementById(ans_id).style.display='';
		}
		else
		{
			document.getElementById(ans_id).style.display='none';
		}
		//alert(qns_id+"==ppp="+clickqns+"=ppp="+ans_id);
	}
}

////// this is for contact - us page ///////////
function chk_contact_us()
{
	document.getElementById('fname').style.visibility='hidden';
	document.getElementById('emailid').style.visibility='hidden';
	document.getElementById('validemail').style.visibility='hidden';
	document.getElementById('veremailid').style.visibility='hidden';
	document.getElementById('daytimephone').style.visibility='hidden';
	
	if(document.frmContact.txtFname.value=="")
	{ 
		document.frmContact.txtFname.focus();
		custAlert('fname','432px','-62px');
		return false;
	}
	if(document.frmContact.txtDayphone.value=="")
	{ 
		custAlert('daytimephone','432px','-62px');
		document.frmContact.txtDayphone.focus(); 
		return false;
	} 
	if(document.frmContact.txtEmail.value=="")
	{ 
		custAlert('emailid','432px','-62px');
		document.frmContact.txtEmail.focus(); 
		return false;
	} 
	if(document.frmContact.txtEmail.value != "")
	{ 
		if(!Is_Email(document.frmContact.txtEmail.value)) {
			custAlert('validemail','432px','-62px');
			document.frmContact.txtEmail.focus(); 
			return false;
		}
	} 
	if(document.frmContact.txtEmail.value != document.frmContact.txtVerEmail.value)
	{ 
		custAlert('veremailid','432px','-62px');
		document.frmContact.txtVerEmail.focus(); 
		return false;
	}
	if(document.frmContact.captcha.value=="")
	{ 
		custAlert('stringcode','432px','-60px');
		document.frmContact.captcha.focus(); 
		return false;
	} 
}

////// end ////////////////////////////////////