function doPopup(URL,width,height,bars) {
	
var randomnumber=Math.floor(Math.random()*1001);
var win= 'madetomeasure';
var windowname= win + randomnumber;
var URL = URL.replace('+', '%2B');
window.open(URL,windowname,'width='+width+',height='+height+',left=0,top=0,toolbar=0,status=0,scrollbars='+bars+',resizable=1');
}

function printpage() {
window.print();  
}


function download(url) {
		
		window.location = 'php/download.php?url='+url;
}

function disableCtrlKeyCombination(e)
{
    //list all CTRL + key combinations you want to disable
    var forbiddenKeys = new Array('c', 'v');
    var key;
    var isCtrl;
    if(window.event)
    {
       key = window.event.keyCode;     //IE
       if(window.event.ctrlKey) {
            isCtrl = true;
       } else {
            isCtrl = false;
       }
     }
     else
     {
        key = e.which;     //firefox
        if(e.ctrlKey) {
            isCtrl = true;
        }
        else
           isCtrl = false;
        }

        //if ctrl is pressed check if other key is in forbidenKeys array
        if(isCtrl)
       {
          for(i=0; i<forbiddenKeys .length; i++)
          {
             //case-insensitive comparation
             if(forbiddenKeys[i].toLowerCase() == String.fromCharCode(key).toLowerCase())
            {
                 alert('Copy option has been disabled');
                 return false;
             }
          }
       }
     return true;
}

function confirmEmailCheck(email, confirmEmail){
  if(email.value != confirmEmail.value){
    alert("The email in the 'Confirm Email' field doesn't match with the email you've entered.");
  }  
}

function addDeliveryPrice(obj) {      
    var totalPrice = document.getElementById("total_price");
    var subTotalPrice = document.getElementById("sub_total_price");
    var deliveryMethodId = document.getElementById("delivery_method_id");
    var deliveryDescription = document.getElementById("delivery_description");
    
    selectedDeliveryOption = document.getElementById("deliverySelector").value;
    newPrice = parseFloat(subTotalPrice.innerHTML) + deliveryOptions[selectedDeliveryOption];
    totalPrice.innerHTML = newPrice.toFixed(2);
    deliveryDescription.innerHTML = deliveryDescriptions[selectedDeliveryOption]
}


