  function evaluate_price(amount,value,action){   
	  switch(action){   		
		case "+": 
			return parseFloat(amount) + parseFloat(value);   					
		break;   		
		case "-": 
			return parseFloat(amount) - parseFloat(value);
		break;
		case "/": 
			return parseFloat(amount) / parseFloat(value);
		break;
		case "*":
			return parseFloat(amount) * parseFloat(value);
		break;   		
		default: 
			return parseFloat(amount) + parseFloat(value);
		break;
	  }
  }

  //display price on page loaded   
  function display_price(price,yearprice){
	  if(document.getElementById('extra_licence')){
		  if(document.getElementById('chk'+document.getElementById('extra_licence').value) && document.getElementById('chk'+document.getElementById('extra_licence').value).checked)
		  {
			document.cart_quantity.lccount.value = 1;
		  }
	  }
	  if(document.getElementById('prdo_year')){
		document.getElementById('prdo_year').checked=true;
	  }
	  if(document.getElementById('chk11')){
		document.getElementById('chk11').checked=false;
	  }
	  if(document.getElementById('licence_amount')){
		document.getElementById('licence_amount').value="";
	  }
	 
	  if(document.getElementById('modules_id')){
		var mdoules_id = document.getElementById('modules_id').value;
		modules_id = mdoules_id.split(",");
	  }

      if(document.getElementById('chk18')){
	    document.getElementById('chk18').checked=false;
	  }

      if(document.getElementById('modules_id')){
		for(i=0;i<modules_id.length-1;i++){
			document.getElementById('chk'+modules_id[i]).checked=false;		
		} 
	  }



	  if(document.getElementById('prdo_year') && document.getElementById('prdo_year').checked){
		price = parseFloat(yearprice);
		if(document.getElementById('modules_id')){
			for(i=0;i<modules_id.length-1;i++){
				tmp = parseFloat(document.getElementById('chky'+modules_id[i]).value);
				document.getElementById('chp'+modules_id[i]).innerHTML = '$'+tmp.toFixed(2);
			} 
		}
	  }else{
		price = parseFloat(price);
		if(document.getElementById('modules_id')){
			for(i=0;i<modules_id.length-1;i++){
				tmp = parseFloat(document.getElementById('chkp'+modules_id[i]).value);
				document.getElementById('chp'+modules_id[i]).innerHTML = '$'+tmp.toFixed(2);
			}
		}
	  }

	  amount = parseFloat(price);
	  document.getElementById('product_amount').value = price.toFixed(2);
	  document.getElementById('total_amount').value = amount.toFixed(2);
  }
  
  //count the licener number selected price
  function count_licence(price){
	var amount,licence_total,count;
		if(document.getElementById('prdo_year') && document.getElementById('prdo_year').checked){
			price = parseFloat(document.getElementById('lcpy').value);
		}else{
			price = parseFloat(document.getElementById('lcpp').value);
		}
		
		count = parseInt(document.cart_quantity.lccount.value);
		nCount = document.getElementById('licence_amount').value ;
		licence_total = count * parseFloat(price);
		document.getElementById('licence_amount').value = parseFloat(licence_total).toFixed(2);
		amount = parseFloat(licence_total) + parseFloat(document.getElementById('total_amount').value) - nCount;
		document.getElementById('total_amount').value = parseFloat(amount).toFixed(2);
  }
  
  //get the licenec price
  function get_licenec_price(){ 
	if(document.getElementById('chk'+document.getElementById('extra_licence').value) && document.getElementById('chk'+document.getElementById('extra_licence').value).checked)
	{ 
		if(document.getElementById('prdo_year') && document.getElementById('prdo_year').checked){
			price = parseFloat(document.getElementById('lcpy').value);
		}else{
			price = parseFloat(document.getElementById('lcpp').value);
		}
	}else{
		price = 0;
	}
	count = parseInt(document.cart_quantity.lccount.value);
	return (count * parseFloat(price));
  }
  
  function licence_price(price,cid,yearprice){
	var amount,licence_amount;
	if(document.getElementById('prdo_year') && document.getElementById('prdo_year').checked){
		price = parseFloat(yearprice);
	}else{
		price = parseFloat(price);
	}

	if(document.getElementById('chk'+cid).checked){
		document.getElementById('lcount').className = 'reveal';
		document.getElementById('server_licence').className = 'reveal';
		document.getElementById('licence_amount').value = parseFloat(price).toFixed(2);
		amount = parseFloat(document.getElementById('licence_amount').value) + parseFloat(document.getElementById('total_amount').value);
	}else{
		document.cart_quantity.lccount.value = 1;
		document.getElementById('lcount').className = 'hidden';
		document.getElementById('server_licence').className = 'hidden';
		licence_amount = document.getElementById('licence_amount').value;
		document.getElementById('licence_amount').value = '';
		if(licence_amount != ""){
	  	    amount = parseFloat(document.getElementById('total_amount').value) - parseFloat(licence_amount);
		}else{
			amount = parseFloat(document.getElementById('total_amount').value) - parseFloat(price);
		}
    }

	document.getElementById('total_amount').value = amount.toFixed(2);
  }
  
  function licence_Type_price(price,cid,action){
	var amount;
	if(document.getElementById('rdo'+cid).checked== true){
		amount = parseFloat(price) + parseFloat(document.getElementById('total_amount').value);
	}else{
		amount = parseFloat(document.getElementById('total_amount').value) - parseFloat(price);
	}
	
	if(document.getElementById('prdo_year') && document.getElementById('prdo_year').checked){
		amount /= 2;
	}
	
	document.getElementById('total_amount').value = amount.toFixed(2);
  }
  
  function licence_Period_price(price,cid,action){
	var amount;   
	if(document.getElementById('modules_id')){
		var mdoules_id = document.getElementById('modules_id').value;
		modules_id = mdoules_id.split(",");
	}
	
	module_price = 0;
	licence_amount = 0;
	if(document.getElementById('prdo_permanent') && document.getElementById('prdo_permanent').checked){
		product_amount = parseFloat(document.getElementById('product_price_high').value);
		licence_amount = get_licenec_price();
		document.getElementById('licence_period').value = 0;
		if(document.getElementById('modules_id')){
			
			for(i=0;i<modules_id.length-1;i++){
				tmp = parseFloat(document.getElementById('chkp'+modules_id[i]).value);
				document.getElementById('chp'+modules_id[i]).innerHTML = '$'+tmp.toFixed(2);

				if(document.getElementById('chk'+modules_id[i]).checked){
					module_price += tmp;
				}
			}
		}
		
		amount = parseFloat(product_amount) + parseFloat(module_price) + parseFloat(licence_amount) ;
	}




	if(document.getElementById('prdo_year') && document.getElementById('prdo_year').checked){
		product_amount = parseFloat(document.getElementById('product_price_low').value);
		licence_amount = get_licenec_price();
		document.getElementById('licence_period').value = 1;
		if(document.getElementById('modules_id')){
			for(i=0;i<modules_id.length-1;i++){
				tmp = parseFloat(document.getElementById('chky'+modules_id[i]).value);
				document.getElementById('chp'+modules_id[i]).innerHTML = '$'+tmp.toFixed(2);
				if(document.getElementById('chk'+ modules_id[i]).checked){
					module_price += tmp;
				}
			}
		}
		
		amount = parseFloat(product_amount) + parseFloat(module_price) + parseFloat(licence_amount) ;
	}

/////alert(licence_amount);
	document.getElementById('licence_amount').value = licence_amount.toFixed(2);
	document.getElementById('total_amount').value = amount.toFixed(2);
	document.getElementById('product_amount').value = product_amount.toFixed(2);
  }
  
  // module price count here    
  function module_price_count(price,cid,yearprice){
	var total_amount;
	if(document.getElementById('prdo_year') && document.getElementById('prdo_year').checked){
		price = parseFloat(yearprice);
	}else{
		price = parseFloat(price);
	}
	
	chkBox = document.getElementById('chk'+cid);
	if(document.getElementById('total_amount').value == ''){
		total_amount = 0;
	}else{
		total_amount = parseFloat(document.getElementById('total_amount').value);
	}

	if(chkBox.checked){
		document.getElementById('chp'+cid).innerHTML = '$'+price.toFixed(2);
		total_amount = eval(parseFloat(price) + parseFloat(total_amount));
	}else{
		document.getElementById('chp'+cid).innerHTML = '$'+price.toFixed(2);
		total_amount = eval(parseFloat(total_amount) - parseFloat(price));
	}

	document.getElementById('total_amount').value = total_amount.toFixed(2);
  }



  function isValidEmail(str) {
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  }

  function isValidPhone(str) {
  if(!str.match(/^(\()?(\d{3})([\)-\. ])?(\d{3})([-\. ])?(\d{4})$/)) 
   return false;
  return true;
  }



  function checkForm(){

	var b_zip_value = document.getElementById('b_zip').value;
	var s_zip_value = document.getElementById('s_zip').value;

	if(document.getElementById('b_fname').value == ''){
		alert('Please Enter Your Name for billing.');
		document.getElementById('b_fname').focus();
		return false;
	}

	if(document.getElementById('b_firm').value == ''){
		alert('Please Enter Your Firm Name for billing.');
		document.getElementById('b_firm').focus();
		return false;
	}

	if(document.getElementById('b_street1').value == ''){
		alert('Please Enter Your Address for billing.');
		document.getElementById('b_street1').focus();
		return false;
	}

	if(document.getElementById('b_city').value == ''){
		alert('Please Enter Your City Name for billing.');
		document.getElementById('b_city').focus();
		return false;
	}

	if(document.getElementById('b_state').value == ''){
		alert('Please Enter Your State Name for billing.');
		document.getElementById('b_state').focus();
		return false;
	}

	if(document.getElementById('b_phone').value == ''){
		alert('Please Enter Your Phone Numbere for billing.');
		document.getElementById('b_phone').focus();
		return false;
	}

	if(!isValidPhone(document.getElementById('b_phone').value)){
		alert('Please Enter Your Valid Phone Numbere for billing.');
		document.getElementById('b_phone').focus();
		return false;
	}

	if(document.getElementById('b_zip').value == ''){
		alert('Please Enter Zip Code for billing.');
		document.getElementById('b_zip').focus();
		return false;
	}

	if (b_zip_value.length < 5){
		alert("Your Zip Code must contain a minimum of 5 characters!")
		document.getElementById('b_zip').focus();
		return false;
	}

	if(document.getElementById('b_email').value == ''){
		alert('Please Enter Your Email for billing.');
		document.getElementById('b_email').focus();
		return false;
	}

	if(!isValidEmail(document.getElementById('b_email').value)){
		alert('Please Enter valid Email for billing.');
		document.getElementById('b_email').focus();
		return false;
	}

	if(document.getElementById('b_fax').value == ''){
		alert('Please Enter Your Fax Numbere for billing.');
		document.getElementById('b_fax').focus();
		return false;
	}

	if(!isValidPhone(document.getElementById('b_fax').value)){
		alert('Please Enter Your Valid Fax Numbere for billing.');
		document.getElementById('b_fax').focus();
		return false;
	}


	// shipping address validation


	if(document.getElementById('s_fname').value == ''){
		alert('Please Enter Your Name for shipping.');
		document.getElementById('s_fname').focus();
		return false;
	}	

	if(document.getElementById('s_firm').value == ''){
		alert('Please Enter Your Firm Name for shipping.');
		document.getElementById('s_firm').focus();
		return false;
	}

	if(document.getElementById('s_street1').value == ''){
		alert('Please Enter Your Address for shipping.');
		document.getElementById('s_street1').focus();
		return false;
	}

	if(document.getElementById('s_city').value == ''){
		alert('Please Enter Your City Name for shipping.');
		document.getElementById('s_city').focus();
		return false;
	}

	if(document.getElementById('s_state').value == ''){
		alert('Please Enter Your State Name for shipping.');
		document.getElementById('s_state').focus();
		return false;
	}

	if(document.getElementById('s_phone').value == ''){
		alert('Please Enter Your Phone Numbere for shipping.');
		document.getElementById('s_phone').focus();
		return false;
	}

	if(!isValidPhone(document.getElementById('s_phone').value)){
		alert('Please Enter Your Valid Phone Numbere for shipping.');
		document.getElementById('s_phone').focus();
		return false;
	}

	if(document.getElementById('s_zip').value == ''){
		alert('Please Enter Zip Code for shipping.');
		document.getElementById('s_zip').focus();
		return false;
	}

	if (s_zip_value.length < 5){
		alert("Your Zip Code must contain a minimum of 5 characters!")
		document.getElementById('s_zip').focus();
		return false;
	}

	if(document.getElementById('s_email').value == ''){
		alert('Please Enter Your Email for shipping.');
		document.getElementById('s_email').focus();
		return false;
	}

	if(!isValidEmail(document.getElementById('s_email').value)){
		alert('Please Enter valid Email for shipping.');
		document.getElementById('s_email').focus();
		return false;
	}

	if(document.getElementById('s_fax').value == ''){
		alert('Please Enter Your Fax Numbere for shipping.');
		document.getElementById('s_fax').focus();
		return false;
	}

	if(!isValidPhone(document.getElementById('s_fax').value)){
		alert('Please Enter Your Valid Fax Numbere for shipping.');
		document.getElementById('s_fax').focus();
		return false;
	}

	if(document.getElementById('b_about').value == ''){
		alert('please select one option!');
		document.getElementById('b_about').focus();
		return false;
	}

	if((document.getElementById('security').value == '') || (document.getElementById('security').value.length < 5))
	{
		alert("Security Code must contain a minimum of 5 characters!")
		document.getElementById('security').focus();
		return false;
	}

	if(CheckCardNumber()){
		document.ordForm.submit();
	}

  }



  function checkForm_demo(){

	var b_zip_value = document.getElementById('b_zip').value;
	var s_zip_value = document.getElementById('s_zip').value;

	if(document.getElementById('b_fname').value == ''){
		alert('Please Enter Your Name for billing.');
		document.getElementById('b_fname').focus();
		return false;
	}

	if(document.getElementById('b_firm').value == ''){
		alert('Please Enter Your Firm Name for billing.');
		document.getElementById('b_firm').focus();
		return false;
	}

	if(document.getElementById('b_street1').value == ''){
		alert('Please Enter Your Address for billing.');
		document.getElementById('b_street1').focus();
		return false;
	}

	if(document.getElementById('b_city').value == ''){
		alert('Please Enter Your City Name for billing.');
		document.getElementById('b_city').focus();
		return false;
	}

	if(document.getElementById('b_state').value == ''){
		alert('Please Enter Your State Name for billing.');
		document.getElementById('b_state').focus();
		return false;
	}

	if(document.getElementById('b_phone').value == ''){
		alert('Please Enter Your Phone Numbere for billing.');
		document.getElementById('b_phone').focus();
		return false;
	}

	if(!isValidPhone(document.getElementById('b_phone').value)){
		alert('Please Enter Your Valid Phone Numbere for billing.');
		document.getElementById('b_phone').focus();
		return false;
	}

	if(document.getElementById('b_zip').value == ''){
		alert('Please Enter Zip Code for billing.');
		document.getElementById('b_zip').focus();
		return false;
	}

	if (b_zip_value.length < 5){
		alert("Your Zip Code must contain a minimum of 5 characters!")
		document.getElementById('b_zip').focus();
		return false;
	}

	if(document.getElementById('b_email').value == ''){
		alert('Please Enter Your Email for billing.');
		document.getElementById('b_email').focus();
		return false;
	}

	if(!isValidEmail(document.getElementById('b_email').value)){
		alert('Please Enter valid Email for billing.');
		document.getElementById('b_email').focus();
		return false;
	}

	if(document.getElementById('b_fax').value == ''){
		alert('Please Enter Your Fax Numbere for billing.');
		document.getElementById('b_fax').focus();
		return false;
	}

	if(!isValidPhone(document.getElementById('b_fax').value)){
		alert('Please Enter Your Valid Fax Numbere for billing.');
		document.getElementById('b_fax').focus();
		return false;
	}


	// shipping address validation


	if(document.getElementById('s_fname').value == ''){
		alert('Please Enter Your Name for shipping.');
		document.getElementById('s_fname').focus();
		return false;
	}	

	if(document.getElementById('s_firm').value == ''){
		alert('Please Enter Your Firm Name for shipping.');
		document.getElementById('s_firm').focus();
		return false;
	}

	if(document.getElementById('s_street1').value == ''){
		alert('Please Enter Your Address for shipping.');
		document.getElementById('s_street1').focus();
		return false;
	}

	if(document.getElementById('s_city').value == ''){
		alert('Please Enter Your City Name for shipping.');
		document.getElementById('s_city').focus();
		return false;
	}

	if(document.getElementById('s_state').value == ''){
		alert('Please Enter Your State Name for shipping.');
		document.getElementById('s_state').focus();
		return false;
	}

	if(document.getElementById('s_phone').value == ''){
		alert('Please Enter Your Phone Numbere for shipping.');
		document.getElementById('s_phone').focus();
		return false;
	}

	if(!isValidPhone(document.getElementById('s_phone').value)){
		alert('Please Enter Your Valid Phone Numbere for shipping.');
		document.getElementById('s_phone').focus();
		return false;
	}

	if(document.getElementById('s_zip').value == ''){
		alert('Please Enter Zip Code for shipping.');
		document.getElementById('s_zip').focus();
		return false;
	}

	if (s_zip_value.length < 5){
		alert("Your Zip Code must contain a minimum of 5 characters!")
		document.getElementById('s_zip').focus();
		return false;
	}

	if(document.getElementById('s_email').value == ''){
		alert('Please Enter Your Email for shipping.');
		document.getElementById('s_email').focus();
		return false;
	}

	if(!isValidEmail(document.getElementById('s_email').value)){
		alert('Please Enter valid Email for shipping.');
		document.getElementById('s_email').focus();
		return false;
	}

	if(document.getElementById('s_fax').value == ''){
		alert('Please Enter Your Fax Numbere for shipping.');
		document.getElementById('s_fax').focus();
		return false;
	}

	if(!isValidPhone(document.getElementById('s_fax').value)){
		alert('Please Enter Your Valid Fax Numbere for shipping.');
		document.getElementById('s_fax').focus();
		return false;
	}

	if(document.getElementById('b_about').value == ''){
		alert('please select one option!');
		document.getElementById('b_about').focus();
		return false;
	}

	if(CheckCardNumber()){
		document.ordForm.submit();
	}

  }













  function copy_billing_to_shipping_address(){

	if(document.getElementById('address_copy').checked){

		document.getElementById('s_fname').value = document.getElementById('b_fname').value;

		document.getElementById('s_firm').value = document.getElementById('b_firm').value;

		document.getElementById('s_street1').value = document.getElementById('b_street1').value;

		document.getElementById('s_street2').value = document.getElementById('b_street2').value;

		document.getElementById('s_city').value = document.getElementById('b_city').value;

		document.getElementById('s_state').value = document.getElementById('b_state').value;

		document.getElementById('s_zip').value = document.getElementById('b_zip').value;

		document.getElementById('s_phone').value = document.getElementById('b_phone').value;

		document.getElementById('s_fax').value = document.getElementById('b_fax').value;

		document.getElementById('s_email').value = document.getElementById('b_email').value;

	}else{

		document.getElementById('s_fname').value = "";

		document.getElementById('s_firm').value = "";

		document.getElementById('s_street1').value = "";

		document.getElementById('s_street2').value = "";

		document.getElementById('s_city').value = "";

		document.getElementById('s_state').value = "";

		document.getElementById('s_zip').value = "";

		document.getElementById('s_phone').value = "";

		document.getElementById('s_fax').value = "";

		document.getElementById('s_email').value = "";

	}

  }