// <script>
//*************************************************************************************************
//		Price Comparison Script v6 copyright Kaon Softwares ( http://www.kaonsoftwares.com )
//=================================================================================================
//		NOTICE: Do NOT remove the copyright and/or license information from this file.
//				doing so will automatically terminate your rights to use this program.
//*************************************************************************************************


	function addToCompareList()
	{
		getContentFromUrl("https://pricechecko.com/compare_products_add_ajax.php?productId=866964&action=add", null, "GET", "", "addToCompareListReturn()");
	}

	function addToCompareListReturn()
	{
		showPopInfo('Added to comparison list');
		$('#idCompListLink').show();
	}

	function addToWishlist()
	{
		showPopWait('Loading. Please Wait...');

		getContentFromUrl("https://pricechecko.com/member_productlist_add_ajax.php?productId=866964", $("#divTempConent").get(0), "GET", "", "showReturnedHtml4ProdPage()");
	}

	function handleWLChange(statusNew)
	{
		var nameCombo	= $('#nameCombo').get(0);
		var nameText	= $('#nameText').get(0);

		if ( statusNew ) 
		{ 
			nameCombo.disabled	= true; 
			nameText.disabled	= false; 
			nameText.value		= ''; 
			nameText.focus(); 
		}
		else
		{
			nameCombo.disabled	= false; 
			nameText.disabled	= true;
			nameCombo.focus();
		}
	}

	function performWishlistAdd()
	{
		// Validate the wishlist form
		var isListCurrentY	= $('#isListCurrentY');
		var isListCurrentN	= $('#isListCurrentN');
		var nameText		= $('#nameText');

		if ( isListCurrentN.checked ) 
		{ 
			if ( nameText.value == '' )
			{
				alert('Please Specify Wishlist Name');
				nameText.focus();
				return false;
			}
		}
		
		// Send the wishlist request
		updatePopMsgInline('Processing. Please Wait...');

		getContentFromUrl("https://pricechecko.com/member_productlist_controller.php", $("#divTempConent").get(0), "POST", buildPOST($("#frmWishlistAdd").get(0)), "performWishlistAddReturn()");

		return false;
	}

	function performWishlistAddReturn() 
	{
		responseText = $("#divTempConent").html();

		if ( responseText == 'success' )
		{
			updatePopMsgInline('');
			showPopInfo('Added to Wishlist!');
		}
		else
			updatePopMsgInline(responseText);
	}

	function addPriceAlert()
	{
		showPopWait('Loading. Please Wait...');

		getContentFromUrl("https://pricechecko.com/products_price_alert_ajax.php?productId=866964", $("#divTempConent").get(0), "GET", "", "showReturnedHtml4ProdPage()");
	}

	function performPriceAlertAdd(frm)
	{
		if ( frm.minPrice.value == '' )
		{
			alert('Please provide min price greater than zero.');
			frm.minPrice.focus();
			return false;
		}
		
		updatePopMsgInline('Processing. Please Wait...');

		getContentFromUrl("https://pricechecko.com/member_controller.php", $("#divTempConent").get(0), "POST", buildPOST(frm), "performPriceAlertAddReturn()");

		return false;
	}

	function performPriceAlertAddReturn() 
	{
		responseText = $("#divTempConent").html();

		if ( responseText == 'success' )
		{
			updatePopMsgInline('');
			showPopInfo('Added Price Alert for Product');
		}
		else
			updatePopMsgInline(responseText);
	}

	var productId = '866964';
	function referFriend()
	{
		showPopWait('Loading. Please Wait...');

		getContentFromUrl("https://pricechecko.com/products_email_friend_ajax.php?productId=866964", $("#divTempConent").get(0), "GET", "", "showReturnedHtml4ProdPage()");
	}

	function performReferFriend(frm)
	{
		if ( frm.remail.value == '' )
		{
			alert('Please provide your friend\'s email address.');
			frm.remail.focus();
			return false;
		}
		
		updatePopMsgInline('Processing. Please Wait...');

		getContentFromUrl("https://pricechecko.com/products_email_friend_process.php?productId="+productId, $("#divTempConent").get(0), "POST", buildPOST(frm), "performReferFriendReturn()");

		return false;
	}

	function performReferFriendReturn() 
	{
		responseText = $("#divTempConent").html();

		if ( responseText == 'success' )
		{
			updatePopMsgInline('');
			showPopInfo('Email Successfully Sent.');
		}
		else
			updatePopMsgInline(responseText);
	}

	function showReturnedHtml4ProdPage()
	{
		updatePopMsgInline('');
		showPop($("#divTempConent").html(), 500, 230, '', '', '', true);
		$("#nameText").focus();
	}

	function referPage2Friend(url)
	{
		updatePopMsgInline('');
		showPopWait('Loading. Please Wait...');
		getContentFromUrl(url, $("#divTempConent").get(0), "GET", "", "referPage2FriendReturn();");
	}

	function referPage2FriendReturn()
	{
		updatePopMsgInline('');
		showPop($("#divTempConent").html(), 650, 350, '', '', '', true);
	}

	function referPage2FriendSubmit(frm)
	{
		updatePopMsgInline('Loading. Please Wait...');

		getContentFromUrl("https://pricechecko.com/email_page_2_friend.php", null, "POST", buildPOST(frm), "");

		return false;
	}

	function showContactInfo(upid)
	{
		showModal('Contact Me', '<img src="https://pricechecko.com/images/info.gif" width="48" height="47" border="0" alt="Info" style="float:left"><div style="width:80%;float:left;margin-left:20px;font:13px/30px Verdana">' + $('#idContactInfo'+upid).html() + '</div><div style="clear:both"></div>', '', true, 0, true);
	}

// </script>
