function getFilteredOffers(id,filterBasis,checkedValue,cityId,basedOn,rootCategoryId)
{
	/*
	new Effect.Fade('offersEffectId', {queue: {position:'front', scope: 'myscopeone'} });
	
	req=GetXmlHttpObject();
	req.open("POST", "filteredOffers.php", true);
	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
	req.onreadystatechange = function (){
	if (req.readyState == 4) {
	if (req.status == 200) {

	var myhtml = req.responseText;
	//alert(document.getElementById('offersBlockId').innerHTML);
	var replacedhtml = "<table border='0' cellspacing='1' style='border-collapse: collapse' bordercolor='#111111' width='100%' id='AutoNumber5' height='76'>";
	replacedhtml+=myhtml;
	replacedhtml+= "</table>";
	document.getElementById('offersEffectId').innerHTML = replacedhtml;
	//alert(document.getElementById('offersBlockId').innerHTML);
	}else if (req.status == 204){
	alert("loading data");
	}}};
	req.send("id="+id+"&filterBasis="+filterBasis);
	*/
	//document.getElementById('offersEffectId2').style.visibility = 'hidden';
	//new Effect.Fade('offersEffectId', {queue: {position:'front', scope: 'myscopeone'} });onComplete
	//new Ajax.Updater('offersEffectId','filteredOffers.php', {method:'post',postBody:'id='+id+'&filterBasis='+filterBasis,asynchronous:true,evalScripts:true});	
	//Effect.Appear('offersTableId');
	//document.getElementById('offersEffectId2').style.visibility = 'block';
	//window.setTimeout('Effect.Appear(\'offersEffectId2\', {duration:.3})',2500);
	if(basedOn == '' || basedOn == null)
	{
		getSearchedOffers(id,filterBasis,checkedValue,cityId);
	}
	else
	{
		new Effect.Fade('offersEffectId',{Duration: 1});
		window.setTimeout("loadContent("+id+",'"+filterBasis+"',"+checkedValue+","+cityId+",'"+basedOn+"','"+rootCategoryId+"')",2500);
/*
		if(filterBasis !='categoryFilter')
			loadCategory(id,filterBasis,checkedValue,cityId,basedOn,rootCategoryId);
		if(filterBasis !='locationFilter')
			loadLocation(id,filterBasis,checkedValue,cityId,basedOn,rootCategoryId);
		if(filterBasis !='brandFilter')
			loadBrand(id,filterBasis,checkedValue,cityId,basedOn,rootCategoryId);
		if(filterBasis !='priceFilter')
			loadPrice(id,filterBasis,checkedValue,cityId,basedOn,rootCategoryId);
*/
	}

}
function getAutoCompleteFilteredOffers(id,filterBasis,checkedValue,cityId,basedOn,rootCategoryId)
{
	new Effect.Fade('offersEffectId');
	window.setTimeout("loadContent("+id+",'"+filterBasis+"',"+checkedValue+","+cityId+",'"+basedOn+"','"+rootCategoryId+"')",100);
	if(filterBasis =='brandFilter')
	{
		$('findBrand').value="";
		loadBrand(id,filterBasis,checkedValue,cityId,basedOn,rootCategoryId);
	}
	if(filterBasis =='locationFilter')
	{
		$('findLocation').value="";
		loadLocation(id,filterBasis,checkedValue,cityId,basedOn,rootCategoryId);
	}
/*
	loadCategory(id,filterBasis,checkedValue,cityId,basedOn,rootCategoryId);
	loadLocation(id,filterBasis,checkedValue,cityId,basedOn,rootCategoryId);
	loadBrand(id,filterBasis,checkedValue,cityId,basedOn,rootCategoryId);
	loadPrice(id,filterBasis,checkedValue,cityId,basedOn,rootCategoryId);
*/
}
function loadContent(id,filterBasis,checkedValue,cityId,basedOn,rootCategoryId)
{
	new Ajax.Updater('offersEffectId','/NewOFS/filteredOffers.php', {method:'post',postBody:'id='+id+'&filterBasis='+filterBasis+'&checkedValue='+checkedValue+'&cityId='+cityId+'&basedOn='+basedOn+'&rootCategoryId='+rootCategoryId,asynchronous:true,evalScripts:true,onCreate:startLoadingCoupon,onSuccess:stopLoading,onComplete:makeAppear});	
}
function makeAppear()
{
	Effect.Appear('offersEffectId',{Duration: 3});
}
function loadCategory(id,filterBasis,checkedValue,cityId,basedOn,rootCategoryId)
{
	new Ajax.Updater('categoryEffectId','/NewOFS/filteredCategories.php', {method:'post',postBody:'id='+id+'&filterBasis='+filterBasis+'&checkedValue='+checkedValue+'&cityId='+cityId+'&basedOn='+basedOn+'&rootCategoryId='+rootCategoryId,asynchronous:true,evalScripts:true});	
}
function loadLocation(id,filterBasis,checkedValue,cityId,basedOn,rootCategoryId)
{
	new Ajax.Updater('locationEffectId','/NewOFS/filteredLocations.php', {method:'post',postBody:'id='+id+'&filterBasis='+filterBasis+'&checkedValue='+checkedValue+'&cityId='+cityId+'&basedOn='+basedOn+'&rootCategoryId='+rootCategoryId,asynchronous:true,evalScripts:true});	
}
function loadBrand(id,filterBasis,checkedValue,cityId,basedOn,rootCategoryId)
{
	new Ajax.Updater('brandEffectId','/NewOFS/filteredBrands.php', {method:'post',postBody:'id='+id+'&filterBasis='+filterBasis+'&checkedValue='+checkedValue+'&cityId='+cityId+'&basedOn='+basedOn+'&rootCategoryId='+rootCategoryId,asynchronous:true,evalScripts:true});	
}
function loadPrice(id,filterBasis,checkedValue,cityId,basedOn,rootCategoryId)
{
	new Ajax.Updater('priceRangeId','/NewOFS/filteredPrices.php', {method:'post',postBody:'id='+id+'&filterBasis='+filterBasis+'&checkedValue='+checkedValue+'&cityId='+cityId+'&basedOn='+basedOn+'&rootCategoryId='+rootCategoryId,asynchronous:true,evalScripts:true,onComplete:updateSlider});	
}
function updateSlider()
{
	setPriceSlider($('minPriceId').innerHTML,$('maxPriceId').innerHTML);
}
function GetXmlHttpObject()
{
	var req;
	if (window.XMLHttpRequest) {
	req = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
	isIE = true;
	req = new ActiveXObject("Microsoft.XMLHTTP");
	}
	return req;
}
function openChatBox()
{
	$('chatbox').innerHTML="<table border='1' bordercolor='#800080'><tr><td align='right'><a href='#' onclick='closeChatBox();return false;'><font face='Trebuchet MS' size='1'>X</font></td></tr><tr><td><embed src='http://widget.meebo.com/mm.swf?yxHpaJQoXE' type='application/x-shockwave-flash' wmode='transparent' width='175' height='275'></embed></td></tr></table>";
}
function closeChatBox()
{
	$('chatbox').innerHTML="";
}
function showChat()
{
	$('chatSpanId').innerHTML="<td colspan='12'><table border='1' bordercolor='voilet'><tr><td align='right'><a href='#' onclick='removeChat();return false;'><font face='Trebuchet MS' size='1'>X</font></td></tr><tr><td><embed src='http://widget.meebo.com/mm.swf?yxHpaJQoXE' type='application/x-shockwave-flash' wmode='transparent' width='175' height='275'></embed></td></tr></table></td>";
}
function removeChat()
{
	$('chatSpanId').innerHTML="<td rowspan='6' height='144'>&nbsp;</td><td colspan='5' rowspan='5' height='110'><img border='0' src='/NewOFS/images/listing-page-17-7-07_78.png' width='75' height='110'></td><td colspan='5' height='110' bgcolor='#757575' rowspan='5'><p align='center'><a href='#' onclick='showChat();return false;'><font face='Trebuchet MS' size='2' color='#FFFFFF'>Click here to talk to us</font></a></td><td rowspan='6' height='144' valign='top'>&nbsp;</td><td height='16'><img src='images/spacer.gif' width='1' height='16' alt=''></td>";
}
function validateForCoupon(emailId,cityId)
{
	new Ajax.Updater('emailEffectId3','/NewOFS/includes/emailValidation.php', {method:'post',postBody:'emailId='+emailId+'&cityId='+cityId,asynchronous:true,evalScripts:true});	
}
function makeEmailBorderRed()
{
	$('emailEffectId2').style.background="#FF0000";
	$('emailEffectId2').style.border="1px";
	$('couponSubscriberSpanId').innerHTML='<font face="Trebuchet MS" style="font-size: 8pt" color="#008000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sign up for Exclusive Offers & Coupons</font>';
	$('emailButton').innerHTML='<img src="/NewOFS/images/listing-page-17-7-07_11.png" width="24" style="opacity:0.3;" height="23" alt="">';
}
function makeEmailBorderGreen(email,city)
{
	$('emailEffectId2').style.background="#008000";
	$('emailEffectId2').style.border="1px";
	$('couponSubscriberSpanId').innerHTML='<font face="Trebuchet MS" style="font-size: 8pt" color="#008000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;You will be <b>subscribed</b> for Exclusive Offers </font>';
	$('emailButton').innerHTML="<img src='/NewOFS/images/listing-page-17-7-07_11.png' width='24' style='cursor: pointer; cursor: hand'  onclick=subscribeForCoupon('"+email+"',"+city+") height='23' alt=''>";
}
function subscribeForCoupon(emailId,cityId)
{
	new Ajax.Updater('couponSubscriberSpanId','/NewOFS/includes/subscribeCoupon.php', {method:'post',postBody:'emailId='+emailId+'&cityId='+cityId+'&action=subscribe',asynchronous:true,evalScripts:true,onSuccess:highlightMessage});	
}
function unsubscribeForCoupon(emailId,cityId)
{
	new Ajax.Updater('couponSubscriberSpanId','/NewOFS/includes/subscribeCoupon.php', {method:'post',postBody:'emailId='+emailId+'&cityId='+cityId+'&action=unsubscribe',asynchronous:true,evalScripts:true,onSuccess:highlightMessage});	
}
function indicateEmailSubscribed(email,city)
{
	$('emailEffectId2').style.background="violet";
	$('emailEffectId2').style.border="1px";
	$('couponSubscriberSpanId').innerHTML='<font face="Trebuchet MS" style="font-size: 8pt" color="#008000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get <b>unsubscribed</b> from Offers Alerts. </font>';
	$('emailButton').innerHTML='<img src="/NewOFS/images/listing-page-17-7-07_11.png" width="24" style="cursor: pointer; cursor: hand" onclick=unsubscribeForCoupon("'+email+'",'+city+') height="23" alt="">';
}
function highlightMessage()
{
	new Effect.Highlight('couponSubscriberSpanId',{startcolor:'#D462FF',endcolor:'#FFFFFF'});
	$('emailIdForCoupon').value='';
}
function getSearchedOffers(id,filterBasis,checkedValue,cityId)
{
	new Effect.Fade('offersEffectId');
	window.setTimeout("loadSearchedContent("+id+",'"+filterBasis+"',"+checkedValue+","+cityId+")",10);
/*
	if(filterBasis !='categoryFilter')
		loadSearchedCategory(id,filterBasis,checkedValue,cityId);
	if(filterBasis !='locationFilter')
		loadSearchedLocation(id,filterBasis,checkedValue,cityId);
	if(filterBasis !='brandFilter')
		loadSearchedBrand(id,filterBasis,checkedValue,cityId);
	if(filterBasis !='priceFilter')
		loadSearchedPrice(id,filterBasis,checkedValue,cityId);
*/
}
function loadSearchedContent(id,filterBasis,checkedValue,cityId)
{
	new Ajax.Updater('offersEffectId','/NewOFS/searchedOffers.php', {method:'post',postBody:'id='+id+'&filterBasis='+filterBasis+'&checkedValue='+checkedValue+'&cityId='+cityId,asynchronous:true,evalScripts:true,onCreate:startLoadingCoupon,onSuccess:makeAppear,onComplete:stopLoading});	
}
function loadSearchedCategory(id,filterBasis,checkedValue,cityId)
{
	new Ajax.Updater('categoryEffectId','/NewOFS/searchedCategories.php', {method:'post',postBody:'id='+id+'&filterBasis='+filterBasis+'&checkedValue='+checkedValue+'&cityId='+cityId,asynchronous:true,evalScripts:true});	
}
function loadSearchedBrand(id,filterBasis,checkedValue,cityId)
{
	new Ajax.Updater('brandEffectId','/NewOFS/searchedBrands.php', {method:'post',postBody:'id='+id+'&filterBasis='+filterBasis+'&checkedValue='+checkedValue+'&cityId='+cityId,asynchronous:true,evalScripts:true});	
}
function loadSearchedLocation(id,filterBasis,checkedValue,cityId)
{
	new Ajax.Updater('locationEffectId','/NewOFS/searchedLocations.php', {method:'post',postBody:'id='+id+'&filterBasis='+filterBasis+'&checkedValue='+checkedValue+'&cityId='+cityId,asynchronous:true,evalScripts:true});	
}
function loadSearchedPrice(id,filterBasis,checkedValue,cityId)
{
	new Ajax.Updater('priceRangeId','/NewOFS/searchedPrices.php', {method:'post',postBody:'id='+id+'&filterBasis='+filterBasis+'&checkedValue='+checkedValue+'&cityId='+cityId,asynchronous:true,evalScripts:true,onComplete:updateSlider});	
}
function loadAutoCompleteBrands(searchText,cityId,basedOn,rootCategoryId)
{
	new Ajax.Updater('brandEffectId','/NewOFS/includes/autoCompleteBrands.php', {method:'post',postBody:'searchText='+searchText+'&cityId='+cityId+'&basedOn='+basedOn+'&rootCategoryId='+rootCategoryId,asynchronous:true,evalScripts:true});	
}
function loadAutoCompleteLocations(searchText,cityId,basedOn,rootCategoryId)
{
	new Ajax.Updater('locationEffectId','/NewOFS/includes/autoCompleteLocations.php', {method:'post',postBody:'searchText='+searchText+'&cityId='+cityId+'&basedOn='+basedOn+'&rootCategoryId='+rootCategoryId,asynchronous:true,evalScripts:true});	
}
function highlightElement(elementId)
{
	new Effect.Highlight(elementId,{startcolor:'#D462FF',endcolor:'#FFFFFF'});
}
function getCoupon(offerId,email,mobileNumber)
{
	new Ajax.Updater('couponValidationId','/NewOFS/includes/validateGetCoupon.php', {method:'post',postBody:'offerId='+offerId+'&email='+email+'&mobileNumber='+mobileNumber,asynchronous:true,evalScripts:true,onCreate:startSendingCoupon,onComplete:stopCouponSendingImage});	
}
function sendCoupon(offerId,email,mobileNumber)
{
	new Ajax.Updater('couponContainerId','/NewOFS/includes/getCoupon.php', {method:'post',postBody:'offerId='+offerId+'&email='+email+'&mobileNumber='+mobileNumber,asynchronous:true,evalScripts:true,onCreate:loadCouponHelpPage});	
}
function contactUs(email,phoneNumber,subject,message)
{
	new Ajax.Updater('contactConfirmationId','/NewOFS/contactUs.php', {method:'post',postBody:'message='+message+'&subject='+subject+'&email='+email+'&phoneNumber='+phoneNumber,asynchronous:true,evalScripts:true});		
}
function showCouponPageOld(offerId)
{
	$('couponbasebox').style.display="block";
	$('couponbox').style.display="block";
	//Element.show("popbox");
	//Element.show("basebox");
	loadCouponPage(offerId);
	//Element.hide('offerContentDiv'+offerId);
	//new Effect.Fade('offerContentDiv'+offerId);
	//loadCouponPage(offerId);
	//new Effect.Opacity('offerContentDiv'+offerId, {duration:0.1, from:1.0, to:0.4});
	//window.setTimeout("loadCouponPage("+offerId+")",1500);
	//new Effect.BlindDown("offerContentDiv"+offerId);
	//new Effect.Opacity('offerContentDiv'+offerId, {duration:0.5, from:1.0, to:0.7});
}
function showCouponPage(offerId)
{
	$('couponbasebox').style.display="block";
	$('couponbox').style.display="block";
	$('offerId').value=offerId;
	pageTracker._trackPageview("/funnel/getCoupon.html");
}
function showVideoPage()
{
	$('videobasebox').style.display="block";
	$('videobox').style.display="block";
}
function loadCouponPage(offerId)
{
	new Ajax.Updater('couponbox','/NewOFS/includes/showCoupon.php', {method:'post',postBody:'offerId='+offerId,asynchronous:true,evalScripts:true,onCreate:showCoupon});
	pageTracker._trackPageview("/funnel/getCoupon.html");
}
function loadCouponHelpPage()
{
	new Ajax.Updater('couponbox','/NewOFS/includes/showCouponHelp.php', {method:'post',asynchronous:true,evalScripts:true});
	pageTracker._trackPageview("/funnel/getCouponThanks.html");
}
function showCoupon()
{
	/*
			new Effect.Parallel([
					new Effect.Scale('popbox', 100, {sync: true,scaleFromCenter: true, scaleContent: false}),
					new Effect.Scale('basebox', 1, {sync: true, scaleFromCenter: true, scaleContent: false})
				], {
					duration: 0.9, 
					delay: 0.9,
					queue: {position: 'end'}
				});
	*/
	new Effect.Scale("couponbox",100,{sync: true,scaleFromCenter: true, scaleContent: false});
}
function closeCoupon()
{
	$('couponbasebox').style.display="none";
	$('couponbox').style.display="none";	
}
function closeVideo()
{
	$('videobasebox').style.display="none";
	$('videobox').style.display="none";	
}
function showCouponHelp()
{
	new Effect.Scale("couponHelpContainerId",100,{scaleY:false, scaleContent: false});
}
function showHelpForCoupon()
{
	//stopLoading();
	new Effect.Scale("couponContainerId",100,{scaleY:false, scaleContent: false});
	pageTracker._trackPageview("/funnel/getCouponThanks.html");
}
function loadOfferDetail(offerId)
{
	new Ajax.Updater('offerDetailId','/NewOFS/includes/showOfferDetail.php', {method:'post',postBody:'offerId='+offerId,asynchronous:true,evalScripts:true});	
}
function showLoading()
{
	$('offerDetailId').innerHTML='<img src="/NewOFS/images/pageLoad2.gif">';
}
function showCouponHelpLoading()
{
	$('couponContainerId').innerHTML='<div width="60px"><img vspace="65" src="/NewOFS/images/pageLoad2.gif"><font color="FFFFFF">Sending Coupon</font></div>';
}
function setEnteredSearchText()
{
	$('searchTerms').value = $('searchBox').value;
}
function setSearchterm(searchTerm)
{
	$('searchTerms').value= searchTerm;
}
function searchKeyword()
{
	startSearchingCoupon();
	if($('offersEffectId'))
		new Effect.Fade('offersEffectId');
	document.searchKeywordForm.submit();
}
function searchByBrand(brandId,brandName)
{
	$('searchBrand').value= brandId;
	$('searchTerms').value= brandName;
	searchKeyword();
}
function getPaginatedOffers(pageNumber,resultsPerPage,totalOffers,direction)
{
	//updatePaginationImages(pageNumber,resultsPerPage,totalOffers,direction);
	new Effect.Fade('offersEffectId');
	window.setTimeout("paginateContent("+pageNumber+")",10);
}
function paginateContent(pageNumber)
{

	var cityId= $('cityId').value;
	var basedOn = $('basedOn').value;
	var rootCategoryId = $('rootCategoryId').value;
	var minPrice = $('minPriceValue').value;
	var maxPrice = $('maxPriceValue').value;
	new Ajax.Updater('offersEffectId','/NewOFS/includes/paginatedOffers.php', {method:'post',postBody:'pageNumber='+pageNumber+'&cityId='+cityId+'&basedOn='+basedOn+'&rootCategoryId='+rootCategoryId+'&minPrice='+minPrice+'&maxPrice='+maxPrice,asynchronous:true,evalScripts:true,onCreate:startLoadingCoupon,onSuccess:makeAppear,onComplete:stopLoading});	
	pageTracker._trackPageview("/pagination/"+pageNumber+"/cat"+rootCategoryId+"/getOffers.html");
}
function getPaginatedSearchOffers(pageNumber,resultsPerPage,totalOffers,direction)
{
	//updatePaginationImages(pageNumber,resultsPerPage,totalOffers,direction);
	new Effect.Fade('offersEffectId');
	window.setTimeout("paginateSearchContent("+pageNumber+")",10);
}
function paginateSearchContent(pageNumber)
{
	var cityId= $('cityId').value;
	var minPrice = $('minPriceValue').value;
	var maxPrice = $('maxPriceValue').value;
	new Ajax.Updater('offersEffectId','/NewOFS/includes/paginatedSearchOffers.php', {method:'post',postBody:'pageNumber='+pageNumber+'&cityId='+cityId+'&minPrice='+minPrice+'&maxPrice='+maxPrice,asynchronous:true,evalScripts:true,onCreate:startLoadingCoupon,onSuccess:makeAppear,onComplete:stopLoading});	
	pageTracker._trackPageview("/searchPagination/"+pageNumber+"/getOffers.html");
}
function updatePaginationImages(pageNumber,resultsPerPage,totalOffers,direction)
{
	if(direction == 'next')
	{
		if(pageNumber*resultsPerPage >= totalOffers)
		{
			$('nextImage').innerHTML = '<img src="/NewOFS/images/next.gif" style="-moz-opacity: 0.6;opacity:.60;filter: alpha(opacity=60);">';
			endNumber = totalOffers;
		}
		else
		{
			nextPageNumber = pageNumber + 1;
			endNumber = pageNumber*resultsPerPage;
			$('nextImage').innerHTML = '<img src="/NewOFS/images/next.gif" onClick=getPaginatedOffers('+nextPageNumber+','+resultsPerPage+','+totalOffers+',"next");>';
		}
		startNumber = (pageNumber-1)*resultsPerPage + 1;
		prevPageNumber = pageNumber - 1;
		$('previousImage').innerHTML = '<img src="/NewOFS/images/prev.gif" onClick=getPaginatedOffers('+prevPageNumber+','+resultsPerPage+','+totalOffers+',"prev");>';
		$('paginationDetails').innerHTML = startNumber+'-'+endNumber+' of '+totalOffers;
	}
	else
	{
		if(pageNumber == 1)
		{
			$('previousImage').innerHTML = '<img src="/NewOFS/images/prev.gif" style="-moz-opacity: 0.6;opacity:.60;filter: alpha(opacity=60);">';
		}
		else
		{
			prevPageNumber = pageNumber - 1;
			$('previousImage').innerHTML = '<img src="/NewOFS/images/prev.gif" onClick=getPaginatedOffers('+prevPageNumber+','+resultsPerPage+','+totalOffers+',"prev");>';
		}
		startNumber = (pageNumber-1)*resultsPerPage + 1;
		endNumber = startNumber + resultsPerPage -1;
		nextPageNumber = pageNumber + 1;
		$('nextImage').innerHTML = '<img src="/NewOFS/images/next.gif" onClick=getPaginatedOffers('+nextPageNumber+','+resultsPerPage+','+totalOffers+',"next");>';
		$('paginationDetails').innerHTML = startNumber+'-'+endNumber+' of '+totalOffers;
	}
}
function highlightDetailCoupon()
{
	$('detailCouponImage').src = "/NewOFS/images/detailCoupon.gif";
}
function dimDetailCoupon()
{
	$('detailCouponImage').src = "/NewOFS/images/details-page-will-all-fe-65.png";
}
function showProductAlertPage(productId)
{
	$('alertbox').style.display="block";
	loadProductAlertPage(productId);
}
function loadProductAlertPage(productId)
{
	new Ajax.Updater('alertbox','/NewOFS/includes/showProductAlert.php', {method:'post',postBody:'productId='+productId,asynchronous:true,evalScripts:true,onComplete:showProductAlert});
}
function showProductAlert()
{
	new Effect.Scale("alertbox",100,{sync: true,scaleFromCenter: true, scaleContent: false});
}
function closeProductAlert()
{
	$('alertbox').style.display="none";
}
function validateProductAlertInputs(productId,emailId,phoneNumber,noOfDays)
{
	new Ajax.Updater('messagePlaceHolder','/NewOFS/includes/validateProductAlert.php', {method:'post',postBody:'productId='+productId+'&emailId='+emailId+'&phoneNumber='+phoneNumber+'&noOfDays='+noOfDays,asynchronous:true,evalScripts:true});	
}
function setProductAlert(productId,emailId,phoneNumber,noOfDays)
{
	new Ajax.Updater('productAlertSpanId','/NewOFS/includes/setProductAlert.php', {method:'post',postBody:'productId='+productId+'&emailId='+emailId+'&phoneNumber='+phoneNumber+'&noOfDays='+noOfDays,asynchronous:true,evalScripts:true,onSuccess:highlightAlertMessage});	
}
function highlightAlertMessage()
{
	closeProductAlert();
	highlightElement('productAlertSpanId');
}
function makeAlertEmailRed()
{
	alertElement('alertEmailIdSpan');
}
function makeAlertPhoneRed()
{
	alertElement('alertPhoneNumberSpan');
}
function makeAlertDaysRed()
{
	alertElement('alertNoOfDaysSpan');
}
function alertElement(elementId)
{
	new Effect.Highlight(elementId,{startcolor:'#E41B17',endcolor:'#FFFFFF'});
}
function showTellAFriendPage(offerId)
{
	$('forwardfriendbox').style.display="block";
	loadTellAFriendPage(offerId);
}
function loadTellAFriendPage(offerId)
{
	new Ajax.Updater('forwardfriendbox','/NewOFS/includes/showTellAFriend.php', {method:'post',postBody:'offerId='+offerId,asynchronous:true,evalScripts:true,onCreate:showTellAFriend});
}
function showTellAFriend()
{
	new Effect.Scale("forwardfriendbox",100,{sync: true,scaleFromCenter: true, scaleContent: false});
}
function closeTellAFriend()
{
	$('forwardfriendbox').style.display="none";
}
function friendMissedOffer(offerId)
{
	if(document.getElementById('forwardFriendDealId'+offerId))
	{
		document.getElementById('forwardFriendDealId'+offerId).innerHTML="Your friend missed the offer.";
		highlightElement('forwardFriendDealId'+offerId);
	}
}
/*
function friendMissedOffer()
{
	document.getElementById('forwardFriendDealId').innerHTML="Your friend missed the offer.";
	highlightElement('forwardFriendDealId');
}
*/
function tellFriend(offerId,friendsEmailIds,myEmailId)
{
	new Ajax.Updater('tellFriendValidationId','/NewOFS/includes/validateTellFriend.php', {method:'post',postBody:'offerId='+offerId+'&friendsEmailIds='+friendsEmailIds+'&myEmailId='+myEmailId,asynchronous:true,evalScripts:true});	
}
function forwardToFriend(offerId,friendsEmailIds,myEmailId)
{
	new Ajax.Updater('forwardFriendDealId','/NewOFS/includes/tellAFriend.php', {method:'post',postBody:'offerId='+offerId+'&friendsEmailIds='+friendsEmailIds+'&myEmailId='+myEmailId,asynchronous:true,evalScripts:true,onSuccess:function highlightForwardFriendMessageTry(offerId){highlightElement('forwardFriendDealId'+offerId);}});	
	closeTellAFriend();
}
function highlightForwardFriendMessage()
{
	closeTellAFriend();
	highlightElement('forwardFriendDealId');
}
function clearTellFriendContent(elementId)
{
	if($('friendsEmailIds').innerHTML == 'Enter comma(,) separated email ids of friends' && elementId=='friendsEmailIds')
		$('friendsEmailIds').innerHTML='';
	if($('myEmailId').value == 'Your email id'  && elementId=='myEmailId')
		$('myEmailId').value='';
}
function validateOfferAlertInputs(keywords,emailId,mobileNumber,noOfDays,name,locationIds)
{
	new Ajax.Updater('messagePlaceHolder','/NewOFS/includes/validateOfferAlert.php', {method:'post',postBody:'keywords='+keywords+'&locationIds='+locationIds+'&emailId='+emailId+'&mobileNumber='+mobileNumber+'&noOfDays='+noOfDays+'&name='+name,asynchronous:true,evalScripts:true,onCreate:startSendingShoppingList,onSuccess:stopLoading});	
}
function setOfferAlert(keywords,locationIds,name,noOfDays,emailId,mobileNumber)
{
	new Ajax.Updater('offerAlertSpanId','/NewOFS/includes/setOfferAlert.php', {method:'post',postBody:'keywords='+keywords+'&locationIds='+locationIds+'&emailId='+emailId+'&mobileNumber='+mobileNumber+'&noOfDays='+noOfDays+'&name='+name,asynchronous:true,evalScripts:true,onCreate:startSendingShoppingList,onSuccess:highlightOfferAlertMessage});	
}
function highlightOfferAlertMessage()
{
	highlightElement('offerAlertSpanId');
	stopLoading();
}
function makeOfferAlertKeywordsRed()
{
	alertElement('alertOfferKeywordsIdSpan');
}
function makeOfferAlertEmailRed()
{
	alertElement('alertOfferEmailIdSpan');
}
function makeOfferAlertPhoneRed()
{
	alertElement('alertOfferPhoneNumberSpan');
}
function makeOfferAlertDaysRed()
{
	alertElement('alertOfferNoOfDaysSpan');
}
function clearOfferAlertContent()
{
	if($('alertOfferKeywordsId').innerHTML == 'For e.g.					Nokia N73,				Candle-lit dinner,				Movie tickets,					Friday beer,					Compaq Laptop')
		$('alertOfferKeywordsId').innerHTML='';
}
function showVendorMapPage(vendorId)
{
	$('mapbasebox').style.display="block";
	$('mapbox').style.display="block";
	loadVendorMapPage(vendorId);
}
function loadVendorMapPage(vendorId)
{
	new Ajax.Updater('mapbox','/vendorMap.php', {method:'post',postBody:'vendorId='+vendorId,asynchronous:true,evalScripts:true,onComplete:showVendorMap});
}
function showVendorMap()
{
	new Effect.Scale("mapbox",100,{sync: true,scaleFromCenter: true, scaleContent: false});
}
function closeVendorMap()
{
	$('mapbasebox').style.display="none";
	$('mapbox').style.display="none";	
}
var currentImageCount = 1;
function rotateImages()
{
	imageList = new Array();
	imageList[0] = "/NewOFS/images/animation1.gif";
	imageList[1] = "/NewOFS/images/animation2.gif";
	imageList[2] = "/NewOFS/images/animation6.gif";
	
	/*
	targetList = new Array();
	targetList[0] = "/NewOFS/searchOffers.php/Windows";
	targetList[1] = "/NewOFS/searchOffers.php/Laptop";
	*/
	/*
	imageList[3] = "/NewOFS/images/animation4.gif";
	imageList[4] = "/NewOFS/images/animation5.gif";
	imageList[5] = "/NewOFS/images/animation6.gif";
	*/
	//new Effect.Fade('ofsDetailsImages',{duration:0.5,from:1.0,to:0.3,queue:'start'});
	
	//$('ofsDetailsImageId').innerHTML='<a href="'+targetList[currentImageCount]+'"><img id="ofsDetailsImages" src="'+imageList[currentImageCount]+'" width="396" height="124" alt=""></a>';

	$('ofsDetailsImages').setAttribute("src",imageList[currentImageCount]);
	currentImageCount=(currentImageCount<imageList.length-1)? currentImageCount+1 : 0;
	new Effect.Appear('ofsDetailsImages',{duration:0.9,from:0.2,to:1.0,queue:'end'});
	//new Effect.Appear('ofsDetailsImageId',{duration:0.9,from:0.2,to:1.0,queue:'end'});
}
var couponImageCount = 1;
function changeGetCouponImage()
{
	if(couponImageCount == 1)
	{
		$('couponImageId').innerHTML='<img src="/NewOFS/images/getMCouponNew3.gif" width="154" height="288" alt="">';
		couponImageCount = 2;
	}
	else
	{
		$('couponImageId').innerHTML='<img src="/NewOFS/images/getMCouponNew1.gif" width="154" height="288" alt="">';
		couponImageCount = 1;
	}
/*
	if($('getCouponImage').getAttribute("src")=="/NewOFS/images/getMCouponNew1.gif")
		$('getCouponImage').setAttribute("src","/NewOFS/images/getMCouponNew3.gif");
	else
		$('getCouponImage').setAttribute("src","/NewOFS/images/getMCouponNew1.gif");
*/
}
function showDetailedOffer(offerId,productName)
{
	productName= productName.replace(/ /g,"-");
	location.href="/NewOFS/offersDetail.php/"+offerId+"/"+productName+"-offers-discounts-sales-coupons-deals";
}
function populateShoppingList()
{
	$searchTerm = $('searchedTerm').value;
	if($searchTerm != '')
		$('alertOfferKeywordsId').innerHTML = $searchTerm;
}

var loaded = false;
function startLoading() 
{
    loaded = false;
    //window.setTimeout('showLoadingImage()', 1000);
	showLoadingImage();
}
function showLoadingImage(loadMessage) 
{
    var el = document.getElementById("loading_box");
    if (el && !loaded) 
		{
			el.innerHTML = '<img src="/NewOFS/images/ajaxLoad.gif">&nbsp;<font face="Trebuchet MS" size="3" color="#008000">'+loadMessage+'</font>';
			//new Effect.Appear('loading_box');
		}
}
function stopLoading() 
{
    Element.hide('loading_box');
    loaded = true;
} 
function startSendingShoppingList() 
{
    loaded = false;
    //window.setTimeout('showLoadingImage()', 1000);
	showLoadingImage('Submitting List');
}
function startLoadingCoupon() 
{
    loaded = false;
    //window.setTimeout('showLoadingImage()', 1000);
	showLoadingImage('Loading Coupons');
}
function receiveCoupon()
{
    $('sending_coupon_box').innerHTML = '<img src="/NewOFS/images/ajaxLoad.gif">&nbsp;<font face="Trebuchet MS" size="2" color="#008000">You\'ll receive coupon in 60 sec.</font>';
}
function startSendingCoupon() 
{
    loaded = false;
    //window.setTimeout('showLoadingImage()', 1000);
	//showLoadingImage('');
	showCouponSendingImage();
}
function showCouponSendingImage() 
{
    var el = document.getElementById("sending_coupon_box");
    if (el && !loaded) 
		{
			el.innerHTML = '<img src="/NewOFS/images/ajaxLoad.gif">&nbsp;<font face="Trebuchet MS" size="3" color="#008000"></font>';
			//new Effect.Appear('loading_box');
		}
}
function stopCouponSendingImage() 
{
    $('sending_coupon_box').innerHTML='';
    loaded = true;
} 
function startSearchingCoupon() 
{
    loaded = false;
    //window.setTimeout('showLoadingImage()', 1000);
	showLoadingImage('Searching Coupons');
}
function showCorporateDetails(imageNumber)
{
	Element.hide('detail'+imageNumber);
	new Effect.Appear('corporate'+imageNumber);
}
function hideCorporateDetails(imageNumber)
{
	Element.hide('corporate'+imageNumber);
	new Effect.Appear('detail'+imageNumber);
}
function makeElementRed(elementId)
{
	//new Effect.Highlight(elementId,{startcolor:'#FF0000',endcolor:'#FFFFFF'});
}
function makeEmailRed()
{
	alertElement('emailErrorId');
	//$('emailErrorId').innerHTML="<font color='red'>Email&nbsp;&nbsp; :</font>";
}
function makeMobileRed()
{
	alertElement('mobileErrorId');
	//$('mobileErrorId').innerHTML="<font color='red'>Mobile :</font>";
}
function makeSpanRed(spanId)
{
	alertElement(spanId);
}
function submitenter(e)
{
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;

	if (keycode == 13)
	   {
			setEnteredSearchText();
			searchKeyword();
			return false;
	   }
	else
		   return true;
}
imageAjax = new Image();
imageAjax.src = "/NewOFS/images/ajaxLoad.gif";