<!--
//calculate 10% of selected package to set to daily cap from hidden form fields
function setCap() {
    var setCapProcess = false;
    if (document.body.ProdID != null && document.body.daily_cap != null)
    { // Standard Packages
        var setCapType = "ProdID";
        var setCapProcess = true;
    }
    if (document.body.PromoID != null && document.body.daily_cap != null)
    { // Promo Packages
        var setCapType = "PromoID";
        var setCapProcess = true;
    }
    if (setCapProcess == true)
    {
        for (i=0;i<eval("document.body."+setCapType+".length");i++)
        {
        	if (eval("document.body."+setCapType+"["+i+"].checked"))
        	{
        		document.body.daily_cap.value = Math.floor(eval("document.body.qty_" + eval("document.body."+setCapType+"["+i+"].value") + ".value") * .1);
        	}
        }
    }
}
function checkTZ() {
    var f = document["body"]["timezone[]"];
    var x = 0;

    for(var i = 1; i < f.length; i++){
        if (f[i].checked) {
            x++;
        }
        if(f[i].checked){
            ischecked = true;
        }
    }
    if(x > 0){
        f[0].checked = false;
    }

    if (x >= f.length -1) {
        allTZ();
    }

}
function allTZ() {
    var f = document["body"]["timezone[]"];
    for(var i = 1; i < f.length; i++){
        f[i].checked = false;
    }
    f[0].checked = true;
}
function isTZ() {
    var f = document["body"]["timezone[]"];
    var ischecked = false;
    for(var i = 1; i < f.length; i++){
        if(f[i].checked){
            ischecked = true;
        }
    }
    return(ischecked)
}


function checkURLRedir(x){
    if(x == 'http://demo.p1drevolution.com' || x == 'http://demo.nettravworld.com' || x == ''){
        //Do nothing
    } else {
        var urlRegxp = /^http[s]{0,1}:\/\/[a-z|A-Z|0-9|-]*\.(\w)\.*/i
        return(urlRegxp.test(x))
    }
}

function goGetLeads(){
    var okay = true
    var f = document.body;

    if(f.cRURL.value == 'http://demo.p1drevolution.com' || f.cRURL.value == 'http://demo.nettravworld.com'){
        f.cRURL.value = '';
    }

    if (okay == true && f.cRURL.value > '') {
        okay = checkURLRedir(f.cRURL.value)
        if (!okay) {
            alert("You must enter a valid URL for Redirection ( http://demo.nettravworld.com )");
            f.cRURL.value = 'http://demo.nettravworld.com';
            f.cRURL.select();
            f.cRURL.focus();
        }

    }

    if (okay) {
        f.submit();
    }
}
function goGetShortLeads(){
    var okay = true
    var f = document.body;
    var sched = f.sched_rb;

    if(f.cRURL.value == 'http://demo.p1drevolution.com' || f.cRURL.value == 'http://demo.nettravworld.com'){
        f.cRURL.value = '';
    }

    if (okay == true && f.cRURL.value > '') {
        okay = checkURLRedir(f.cRURL.value)
        if (!okay) {
            alert("You must enter a valid URL for Redirection ( http://demo.nettravworld.com )");
        }

    }
    if (okay == true && f.cRURL.value == '' && sched != null && sched[1].checked) {
        alert("You must enter a valid URL for Redirection ( http://demo.nettravworld.com )");
        f.cRURL.value = 'http://demo.nettravworld.com';
        f.cRURL.select();
        f.cRURL.focus();
        okay = false;
    }

    if (okay) {
        f.submit();
    }
}

function enableDisable(x, y) {
    var f = x;

    for(var i = 0; i < f.length; i++){
        f[i].disabled = y;
    }

    if (x = document["body"]["timezone[]"] && y == false) {
        checkTZ();
    }


}


function validateCompany(){
    var ok = 1;

	if (ok == true){
        if(document.body.Opportunity1){
            var str = document.body.Opportunity2.value;
            str = str.replace(/^\s*|\s*$/g,"");
    		if (document.body.Opportunity1.value == 0 && str.length < 3){
    			alert("Please select your Primary Business Opportunity.")

    			ok = false
    		}else{
    		    document.body.Primary_Opportunity1.value = document.body.Opportunity1.value;
    		    document.body.Primary_Opportunity2.value = document.body.Opportunity2.value;
    		}
    	}
	}

	return(ok);

}

//-->