
function t(e){

	e.parentNode.lastChild.className = (e.parentNode.lastChild.className == "invisible" ? "" : "invisible");
	return false;
}

function getCartItems(cid,el,flag)
{
	divel = document.getElementById("invoiceTable");
	if (flag)
	{
		_el=el;
		for(;_el.nodeName.toLowerCase()!="tr";_el=_el.parentNode);
		if (!getCartItems("","",0)) {
			_el.id="boldTR";
			eltbl = divel.getElementsByTagName("tr");
			for (i=0;i<eltbl.length && eltbl[i]!=_el;i++);
			eltbl[i+1].id="insertCart";
		}
	} else {
		__el = document.getElementById("boldTR");
		if (__el) {
			__el.id="";
			__el = document.getElementById("insertCart");
			if (__el) {__el.id="hideCart";return true;} else return false;
		}
	}
}

function showCart(cid,el,flag)
{
	
	if (flag)
	{
	for(;el.nodeName.toLowerCase()!="tr";el=el.parentNode);
	__el=el.getElementsByTagName("td");
	for(i=0;i<4;i++)
		__el[i].className="hidetd";

	__el[i].className="";
	}
	else 
	{
		
		for(;el.nodeName.toLowerCase()!="tr";el=el.parentNode);
		for(el=el.parentNode;el.nodeName.toLowerCase()!="tr";el=el.parentNode);
		__el=el.getElementsByTagName("td");
		for(i=0;i<4;i++)
		__el[i].className="";							
		__el[i].className="hidetd";
	}
}

function alertOnClose(page){
	var alertPages = new Array ("generic-","shoppingcart","checkout","important","subscribe");
	for(var i=0;i<alertPages.length;i++){
		if (page.indexOf(alertPages[i],page.indexOf('generic-pharmacy.net')+20)!=-1 && page.indexOf("about")==-1)
			return true;
	}
	return false;
}

$(document).ready(function(){
	//alert(document.refreshForm.visited.value);
	/*
	if ('<?php echo isset($_SESSION['lmc_launch'])?$_SESSION['lmc_launch']:""?>' == '1'){
		tb_show("","#TB_inline?height=470&width=580&inlineId=lastmin_popup");
	}
	*/
	$("a,select,button").click(function () { 
		aClicked = true;
	});
	
	$(document).keypress(function(e){
		 var key;
		 if(window.event)
			  key = window.event.keyCode; //IE
		 else
			  key = e.which; //FF
		if (key == 0) aClicked=true;
	});
	$(document).keydown(function(e){
		var key;
		 if(window.event)
			  key = window.event.keyCode; //IE
		 else
			  key = e.which; //FF
		if (key == 116 || key == 17) aClicked=true;
	});
});