function launchWindow(id) {

	//Get the screen height and width
	var maskHeight = $(document).height();
	var maskWidth = $(window).width();

	//Set heigth and width to mask to fill up the whole screen
	$('#mask1').css({'width':maskWidth,'height':maskHeight});
	
	//transition effect		
	//$('#mask1').fadeIn(1000);	
	//$('#mask1').fadeTo("slow",0.8);	

	//Get the window height and width
	var winH = $(window).height();
	var winW = $(window).width();
		  
	//Set the popup window to center
	$(id).css('top',  120);
	$(id).css('left', winW/2-$(id).width()/2);

	//transition effect
	$(id).fadeIn(2000); 
	

}
function toggleDiv(id,flagit) {
if (flagit=="1"){
if (document.layers) document.layers[''+id+''].visibility = "show"
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "visible"
}
else
if (flagit=="0"){
if (document.layers) document.layers[''+id+''].visibility = "hide"
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden"
}
}

function checkoutmembership () { 
	var member	= document.frm_membercheckout;
	if (member.checkoutemail.value =='') {
		alert('Please Enter Your Emailid!');
		member.checkoutemail.focus();
		return false;
	}
	else if(IsEmail(member.checkoutemail.value)==false) {
		alert("Please Enter Valid EmailId!");
		member.checkoutemail.focus();
		return false;
	}
	else if (member.checkoutpassword.value == '') { 
		alert('Please Enter Your Password!');
		member.checkoutpassword.focus();
		return false;
	}
}
function IsEmail(oObject) {
	var emailStr=oObject;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);
	if (matchArray==null) {
		alert("Email address seems incorrect (check @ and .'s)");
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];
	if (user.match(userPat)==null) {
		alert("The username doesn't seem to be valid. Please check or register fresh");
		return false;
	}
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {
		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				alert("Destination IP address is invalid!");
				return false;
			}
		}
		return true;
	}
	var domainArray=domain.match(domainPat);
	if (domainArray==null) {
		alert("The domain name doesn't seem to be valid.");
		return false;
	}
	var atomPat=new RegExp(atom,"g");
	var domArr=domain.match(atomPat);
	var len=domArr.length;
	if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) {
		alert("The address must end in a three-letter domain, or two letter country.");
		return false;
	}
	if (len<2) {
		var errStr="This address is missing a hostname!";
		alert(errStr);
		return false;
	}
	return true;
}

xMousePos = 0; // Horizontal position of the mouse on the screen
yMousePos = 0; // Vertical position of the mouse on the screen
xMousePosMax = 0; // Width of the page
yMousePosMax = 0; // Height of the page

function HideDIV(d) { document.getElementById(d).style.display = "none"; }
function DisplayDIV(d) { 
	if (document.layers) {
	// When the page scrolls in Netscape, the event's mouse position
	// reflects the absolute position on the screen. innerHight/Width
	// is the position from the top/left of the screen that the user is
	// looking at. pageX/YOffset is the amount that the user has 
	// scrolled into the page. So the values will be in relation to
	// each other as the total offsets into the page, no matter if
	// the user has scrolled or not.
	xMousePos = e.pageX;
	yMousePos = e.pageY;
	xMousePosMax = window.innerWidth+window.pageXOffset;
	yMousePosMax = window.innerHeight+window.pageYOffset;
	} 
	else if (document.all) {
	// When the page scrolls in IE, the event's mouse position 
	// reflects the position from the top/left of the screen the 
	// user is looking at. scrollLeft/Top is the amount the user
	// has scrolled into the page. clientWidth/Height is the height/
	// width of the current page the user is looking at. So, to be
	// consistent with Netscape (above), add the scroll offsets to
	// both so we end up with an absolute value on the page, no 
	// matter if the user has scrolled or not.
	xMousePos = window.event.x+document.body.scrollLeft;
	yMousePos = window.event.y+document.body.scrollTop;
	xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
	yMousePosMax = document.body.clientHeight+document.body.scrollTop;
	} 
	else if (document.getElementById) {
	// Netscape 6 behaves the same as Netscape 4 in this regard 
	xMousePos = e.pageX;
	yMousePos = e.pageY;
	xMousePosMax = window.innerWidth+window.pageXOffset;
	yMousePosMax = window.innerHeight+window.pageYOffset;
	}
	//alert(xMousePos);
	//alert(yMousePos);
	//alert(xMousePosMax);
	//alert(yMousePosMax);
	document.getElementById(d).style.left = xMousePos;
	document.getElementById(d).style.top = yMousePos+10;
	document.getElementById(d).style.display = "block"; 
}
function HideDIV1(d) { document.getElementById(d).style.display = "none"; }
function DisplayDIV1(d) { 
	document.getElementById(d).style.display = "block"; 
}
function handleResponse_addtocart() { 
	if(httpaddtocart.readyState == 4) {
		if(httpaddtocart.status == 200) {
			var response = httpaddtocart.responseText;
			var ship_option = response.split('@@@'); 
			var divid = "devimage"+ship_option[2];
			var divadded = "productinfo"+ship_option[2];
			var load1	=	"<table bgcolor='#f7f8f9' cellspacing='0'>";
			load1	+=	"<tr><td align='left'>";
			load1	+=	"<img src='../images/add-to-cart.gif' border='0'></td></tr>";
			load1	+=	" </table>";
			var cartload = "<table width='273' border='0' cellspacing='0' cellpadding='0'>";
            cartload += "<tr><td width='26'><img src='../images/cart-icon-l.jpg' width='26' height='18'></td>";
			cartload += "<td align='left' width='70' bgcolor='#FDFDFF' class='cart-txt'> Item(s)&nbsp; "+ship_option[0]+"</td>";
			cartload += "<td align='right' width='88' bgcolor='#FFFFFF' class='cart-txt2'>Rs."+ship_option[1]+"</td>";
			cartload += "<td width='10'><img src='../images/cart-r.gif' width='10' height='18'></td>";
			cartload += "<td align='center' width='79'><a href='../shopping-detail.php'><img src='../images/view-cart-btn.jpg' width='79' height='18' border='0'></a></td>";
			cartload += "</tr></table>";
			orderID11 = document.getElementById('shopping_cartinfo');
			orderID11.innerHTML		=	'';
			orderID11.innerHTML		=	cartload;
			orderID11.style.display	=	'block';
			imageID = document.getElementById(divid);
			imageID.innerHTML		=	'';
			imageID.innerHTML		=	load1;
			imageID.style.display	=	'block';
			/*imageID1 = document.getElementById(divadded);
			imageID1.innerHTML		=	'';
			imageID1.innerHTML		=	"<table border='0' cellpadding='0' cellspacing='0'><tr><td align='left' valign='bottom'><a href='http://www.fommy.co.in/shopping-detail.php' class='txt-blue-bld'>SKU added, view cart</a></td></tr></table>";
			imageID1.style.display	=	'block';*/

			$("#alkcart").jGrowl("The following product has been added to the Shopping Cart. <br /><b>SKU : "+ship_option[2]+" <br />QTY : 1 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='http://www.fommy.co.in/shopping-detail.php'><font style='font-size:14px' color='#993366'>View Cart</font></a></b>");
		}
			
	}
}
function add_shopping_cart(x,y) {
	var load	=	"<table bgcolor='#f7f8f9' cellspacing='0'>";
		load	+=	"<tr><td align='left'>";
		load	+=	"<img src='../images/loading.gif' border='0'></td></tr>";
		load	+=	" </table>";
	if (httpaddtocart) {
		httpaddtocart.open("GET", "../additem_new.php?purchaseSKU="+x+"&purchaseqty=1");
		orderID = document.getElementById(y);
		orderID.innerHTML		=	'';
		orderID.innerHTML		=	load;
		orderID.style.display	=	'block';
		httpaddtocart.onreadystatechange = handleResponse_addtocart;
		httpaddtocart.send(null);
	}
}

function createRequestaddtocart() {
	var ro;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
		ro = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else {
		ro = new XMLHttpRequest();
	}
	return ro;
}

var httpaddtocart = createRequestaddtocart();

function calcute_postion() { 
	flashID = document.getElementById("flashalk");
	if ((screen.width>1200) && (screen.height>800)) { 
		flashID.style.left = '185px';
		flashID.style.top = '148px';
		flashID.style.width = '750px';
		flashID.style.height = '250px';;
	}
	else if ((screen.width>1020) && (screen.height>700)) { 
		flashID.style.left = '185px';
		flashID.style.top = '148px';
		flashID.style.width = '750px';
		flashID.style.height = '250px';
	}
	else { 
		flashID.style.left = '185px';
		flashID.style.top = '148px';
		flashID.style.width = '800px';
		flashID.style.height = '240px';
	}
}
function AddToCart(url, type,sku){ 
	var parameters="";
	try {
		req = new XMLHttpRequest(); /* e.g. Firefox */
	} catch(e) {
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP"); /* some versions IE */
		} catch (e) {
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP"); /* some versions IE */ }
			catch (E) {
				req = false;
			}
		}
	}
	req.onreadystatechange = function() { 
	//responseAHAHsort(fname);
	responseAddToCart(sku);
	};
	//alert(url);
	req.open(type,url,true);
	
    req.setRequestHeader("Content-length", parameters.length);
	if(parameters == '') parameters = null;
	req.send(parameters);
	
}

function responseAddToCart(fname) {
	if(req.readyState == 1 ) { //loading
		/*if(document.getElementById('busy-'+fname) != null){ 
			document.getElementById('busy-'+fname).style.display = "block";
			document.getElementById('addbutton-'+fname).style.display = "none";
		}*/
		//document.getElementById('dialog').innerHTML ="<img src='../images/loading.gif'>";
	}
	else if(req.readyState == 4) {
		if(req.status == 200) {
			var response = req.responseText;
			var ship_option = response.split('@@@'); 
			var load1	=	"<table bgcolor='#f7f8f9' cellspacing='0'>";
			load1	+=	"<tr><td align='left'>";
			load1	+=	"<img src='../images/add-to-cart.gif' border='0'></td></tr>";
			load1	+=	" </table>";
			var cartload = "<table width='273' border='0' cellspacing='0' cellpadding='0'>";
				cartload += "<tr><td width='26'><img src='../images/cart-icon-l.jpg' width='26' height='18'></td>";
				cartload += "<td align='left' width='70' bgcolor='#FDFDFF' class='cart-txt'> Item(s)&nbsp; "+ship_option[0]+"</td>";
				cartload += "<td align='right' width='88' bgcolor='#FFFFFF' class='cart-txt2'>Rs."+ship_option[1]+"</td>";
				cartload += "<td width='10'><img src='../images/cart-r.gif' width='10' height='18'></td>";
				cartload += "<td align='center' width='79'><a href='../shopping-detail.php'><img src='../images/view-cart-btn.jpg' width='79' height='18' border='0'></a></td>";
				cartload += "</tr></table>";
			orderID11 = document.getElementById('shopping_cartinfo');
			orderID11.innerHTML		=	'';
			orderID11.innerHTML		=	cartload;
			orderID11.style.display	=	'block';
		}
		else {
			//document.getElementById('info-'+fname).style.display = "none";
			alert("Error occured, Please try again");
			//alert(req.responseText+'=====req.responseText');
		}
	}
}