
var pop = true;
//var nolaunchClick = true;

function thankyou(uid) {
    document.cookie = "thankyou=" + uid + "; path=/";
}

function dopop(url) {
   if(pop) {  
	//popunder();
        openBareWin(url,480,480);
        //return showChat();
   }
}


function popunder() {
   if (pop) {
       window.open('http://best-health-source.com/pop.xsl','health','width=500,height=500,left=200,top=200').blur();
       window.focus();
  }
}


function show_ssl_info(referrer)
{
    var url = "https://smarticon.geotrust.com/smarticonprofile?Referer=" + referrer;
    var features = "status=1,location=0,scrollbars=1,resizeable=yes,width=400,height=600";
    var w = window.open(url, 'ssl_info', features);
    
    w.focus();
}

function openWin(url, width, height) 
{
    var features = "toolbar=yes,location=yes,directories=no,status=yes," + 
	"menubar=yes,marginwidth=0,marginheight=0,resizable=yes,scrollbars=" +
	"yes,width=" + width + ",height=" + height;
    
    if(pop) {  
	popup_win(url, 'results', features);
    }
}

function openBareWin(url, width, height) 
{
    var features = "toolbar=no,location=no,directories=no,status=no," + 
	"menubar=no,marginwidth=0,marginheight=0,resizable=yes,scrollbars=" +
	"yes,width=" + width + ",height=" + height;
    
    if(pop) {  
	    popup_win(url, 'results', features);
    }
}

function popup_win(url, name, features) 
{
    window.open(url, name, 'screenX=0,screenY=0,left=0top=0,' + features);
}

function validate_ccnumber(ccnumber)
{
    var msg;
    
    ccnumber.value = ccnumber.value.replace(/\D/g, '');
    if(ccnumber.value.length < 13 ||
       isNaN(ccnumber.value)) {
	msg = 'Please provide a valid credit card number.';    
	alert(msg);
	
	return 1;
    }
    
    return 0;
}

function validate_ccmonth(ccmonth)
{
    var msg;
    
    if(ccmonth.selectedIndex == 0) {
	msg = 'Please select your credit card expiration month.';    
	alert(msg);
	
	return 1;
    }
    
    return 0;
}

function validate_ccyear(ccyear)
{
    var msg;
    
    if(ccyear.selectedIndex == 0) {
	msg = 'Please select your credit card expiration year.';    
	alert(msg);
	
	return 1;
    }
    
    return 0;
}

function validate_email(email)
{
    if(email.value.length == 0 ||
       email.value.indexOf('@') == -1 || 
       email.value.indexOf('.') == -1) {
	alert('Please provide your valid email address.');
	
	return 1;
    }
    
    return 0;
}

function validate_telephone(telephone)
{
    var msg;
    
    telephone.value = telephone.value.replace(/\D/g, '');
    
    if(telephone.value.length < 10 ||
       isNaN(telephone.value)) {
	msg = 'Please provide a valid Telephone number.';
	alert(msg);
	telephone.value = "";
	
	return 1;
    }
    
    return 0;
}




function value(key)
{
    keys = new Array();
    values = new Array();
    
    var query = window.location.search.substring(1);
    var pairs = query.split("&");
    
    for (var i=0; i < pairs.length; i++) {
	var pos = pairs[i].indexOf('=');
	if (pos >= 0) {
	    var argname = pairs[i].substring(0, pos);
	    var value = pairs[i].substring(pos + 1);
	    keys[keys.length] = argname;
	    values[values.length] = value;
	}
    }
    
    for (var i=0; i < keys.length; i++) {
	if (keys[i] == key) {
	    return values[i];
	}
    }
}





