/********************************/
/***  Filename:	vwr_scripts.js	*/
/***  			                */
/********************************/


/** START LOAD PAGE CSS FILES **/
IE_browser = navigator.userAgent.indexOf("MSIE");
if ( IE_browser != -1 ) {
     IE_version = navigator.userAgent.substring(IE_browser+5, IE_browser+6);
} else { IE_version = -1; }

document.write('<style type="text/css">@import "/common/vwr_styles.css";</style>');
if (IE_browser && (IE_version >= 8)) {
    document.write('<style type="text/css">@import "/common/comply_vwr_styles.css";</style>');
} else if (IE_browser == -1) {
    document.write('<style type="text/css">@import "/common/comply_vwr_styles.css";</style>');
}
/** END LOAD PAGE CSS FILES **/



function show (url, name) {
    var showWin = window.open(url, name, "status,resizable,scrollbars,width=800,height=800");
    showWin.focus();
}

function showAd (url, name) {
    var showWin = window.open(url, name, "status,resizable,width=640,height=200");
    showWin.focus();
}

function bookmarkMe (title, url) {
    if (document.all)
	    { window.external.AddFavorite (url, title); }
    else if (window.sidebar)
	    { window.sidebar.addPanel (title, url, ""); }
}


// Show the Error Background Color
var backHighlight = "#CC9966";
function checkPrice (type) {
    done = true;

    // Strip out '$' and ','
    price      = document.input_amount.vwramount.value.replace(/[$,]/g, '');
	startprice = document.input_amount.vwramount.value.replace(/[.]/g, '');
    if ( (startprice > 0) && (!isNaN(price)) && (price.match(/^\d+\.\d{0,2}$/g)) ) {
	    if (type == 'G') { document.pay_google.item_price_1.value = price; }
		else if (type == 'P') { document.pay_paypal.amount.value = price; }
		else { done = false; }
    } else { done = false; }
	
	if (done == false) { document.input_amount.vwramount.style.background = backHighlight; }
	
	return done;
}



/** START NAVIGATION DISPLAY SCRIPTS **/

var start_back = "";
var backColor  = '#666666';

function highlightOn (index) {		 
    start_back = document.getElementById(index).style.backgroundColor;
	document.getElementById(index).style.backgroundColor = backColor;
}

function highlightOff (index) {
	document.getElementById(index).style.backgroundColor = start_back; 
}

/** END NAVIGATION DISPLAY SCRIPTS **/

