function xmlhttpPost(strURL) {
	var xmlHttpReq = false;
	var self = this;
	// Mozilla/Safari
	if (window.XMLHttpRequest) {
		self.xmlHttpReq = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		//IE
		self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
	}
	self.xmlHttpReq.open('POST', strURL, true);
	self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	self.xmlHttpReq.onreadystatechange = function() {
		if (self.xmlHttpReq.readyState == 4) {
		}
	}
	self.xmlHttpReq.send(getquerystring());
}

function getquerystring() {
	var form = document.forms['mailform'];
	var word = form.mailto.value;
	var mail_id = form.mail_product_id.value;
	qstr = 'mailto=' + escape(word) + '&mail_id=' + escape(mail_id);  // NOTE: no '?' before querystring
	return qstr;
}


function showDescription(action) {
	es = document.getElementById("scent_desc");
	ep = document.getElementById("product_desc");
	if (action == 1) { // show scent_desc, hide product_desc
		ep.style.display = "block";
		es.style.display = "none";
		document.getElementById("menu_1").style.background = 'url("http://img.perfumedeal.com/product_info_menu_selected.gif")';
		document.getElementById("menu_2").style.background = 'url("http://img.perfumedeal.com/product_info_menu_main.gif")';
	}
	if (action == 2) { // show product_desc, hide scent_desc
		ep.style.display = "none";
		es.style.display = "block";
		document.getElementById("menu_2").style.background = 'url("http://img.perfumedeal.com/product_info_menu_selected.gif")';
		document.getElementById("menu_1").style.background = 'url("http://img.perfumedeal.com/product_info_menu_main.gif")';
	}
}

function mouseOverFlowers(rating) {
	for (i=1; i <=rating; i++) {
		elementNam= "flower" + i;
		document.getElementById(elementNam).className = "flower_on";
	}

}

function mouseOutFlowers(rating) {
	for (i=1; i <=rating; i++) {
		elementNam= "flower" + i;
		document.getElementById(elementNam).className = "flower_off";
	}
}


function rate_product(product_id, rating) {
	//alert("product rating: " + products_id + " : " + rating);
	var xmlHttpReq = false;
	var self = this;
	var strURL = '/customer_rate_products.php';

	// Mozilla/Safari
	if (window.XMLHttpRequest) {
		self.xmlHttpReq = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		//IE
		self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
	}
	self.xmlHttpReq.open('POST', strURL, true);
	self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	self.xmlHttpReq.onreadystatechange = function() {
		if (self.xmlHttpReq.readyState == 4) {
			if (self.xmlHttpReq.status==200 || window.location.href.indexOf("http")==-1){
				//document.getElementById("flowers_rating").innerHTML=self.xmlHttpReq.responseText
			}else{
				//alert("An error has occured making the request")
			}
		}
	}
	self.xmlHttpReq.send('product_id='+product_id+"&rating="+rating);

	document.getElementById("flowers_rating").innerHTML='<font color="red">Thanks for Rating!</font>';

	return true;
}

//Start JQuery
$(function() {									
			$("#popOver").hide(); // hides the popover
    		
			$("#button_show_div").mouseover(function(e) {
	             $("#popOver").fadeIn();
	         });			
		    $("#button_show_div").mouseout(function() {
				$("#popOver").fadeOut();
			});
			
			$("#product_video_preview").click(function(e) {
	             $("#popOver2").fadeIn();
				 $("#popOver2_close").fadeIn();
	         });
			
			$("#product_video_preview_close").click(function(e) {
	             $("#popOver2").fadeOut();
				 $("#popOver2_close").fadeOut();
				 $("#popOver2").remove();
	         });
  
			
	        $('#gallery a').lightBox();			

});			  
			
			

