﻿

function RatMedBuyReport()
{
	$("#ctl00_ctl00_MainContent_rightColumn_btnAddToCart").click();
	$("#ctl00_ctl00_MainContent_rightColumn_btnCart").click();
}


//function addItem(item) {
//	var xmlHttp = new XMLHttpRequest();
//	 xmlHttp.open("GET", "../cart/add.ashx?pi=" + item, false);
//}


//
// Determine whether we're on prod or stage
//

//var IS_PROD = (location.hostname.toLowerCase() == "www.weissratings.com");

function addItem(item) {
	w_cart_add("w_cart_add_default_callback", item);
//    var sc = document.createElement('script');
//    var servicer = (IS_PROD? "store.weissinc.com" : "secure.weissinc.com");
//    sc.type = "text/javascript";
//    sc.async = true;
//    sc.src = "https://" + servicer + "/cart/weissratings?js=addItem_CallBack&pi=" + item;
//    var s = document.getElementsByTagName("head")[0];
//    s.appendChild(sc);
}

//
// This is a call back - it can be empty, or you can put something
// more useful in it. To remove it entirely, change ?js=addItem_CallBack to
// ?js=0 above.
//

function addItem_CallBack() {
	alert("Your item was added. Your cart now contains " + (W_WEISS_CART.length) + " items");
}


function btnCsuClick(url) {
	window.parent.open(url, "CSU", "width=800,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes");
}

function readCookie(cookieName) {
	var re = new RegExp('[,; ]' + cookieName + '=([^\\s,;]*)');
	var sMatch = (' ' + document.cookie).match(re);
	if (cookieName && sMatch) return unescape(sMatch[1]);
	return '';
}
function shoppingCount() {
	// Replace "Shopping Cart (xx)" with "Shopping Cart (yy)"
	var newCount = readCookie("wc40itemcount");
	var oldString = "Shopping Cart";
	var newString = "Shopping Cart (" + (newCount).toString() + ")";
	if (newCount > 1) {
		oldString = oldString + " (" + (newCount - 1).toString() + ")";
	}
	var str = lblCartLinkMast.innerHTML;
	if (newCount > 0)
		lblCartLinkMast.innerHTML = str.replace(oldString, newString);
}


function addCPItem(pi)
{
	document.getElementById('loadingImg').style.display='inline';
	
	var xmlHttp = new XMLHttpRequest();
	xmlHttp.open("GET", "../cart/add.ashx?pi=" + pi, false);
	xmlHttp.send(null);

	document.getElementById('loadingImg').style.display = 'none';
	alert(xmlHttp.responseText);
}








