	function Product (sformId){
		this._formId = sformId;
		this._primItem = "";
		this._flagPrim = false;
		this._secItems = "";
		this._secItemProd = "";
		this._message = "";
		this._roductDetail = null;
	}
Product.prototype={
	_isAllAttributeSelected : function(){
		var list = document.forms[this._formId].elements;
		var validateItem = true;
		for( var i=0; i<list.length; i++)
		{
			if(list[i].id.indexOf('attributesValue') !=-1)
			{
				if(list[i].value==''){
					validateItem = false;
					break;
				}else{
					var tmp = list[i].id.split('$');
					var tmpId = tmp[1];
					$('attr_'+tmpId).value = list[i].options[list[i].selectedIndex].text;
				}
			}
		}
		return validateItem;
	},
		  
	_checkMaxFreeProducts : function (statusIndex){
		if($('maxFreeProducts')!= null){
		var maxFree = $('maxFreeProducts').value;
		if(maxFree != 0)
		{
			var elels = document.forms['addToCartFrom'].elements;
			var selectedItems = 0;
			for(i=0;i<elels.length;i++){
				var elem = elels[i];
				if(elem.type == 'checkbox' && elem.id.indexOf('free') != -1 && elem.checked){
					selectedItems++;
				}
			}
			
			if(selectedItems == 0)
			{
					var str1 = i18n("Please_choose") + " ";
					var str2 = " " + i18n("free_products_from_the_list_given_below.");
				  alert(str1 + maxFree + str2);
				  this._clearOthers();
				  return false;
			}else if(selectedItems > maxFree){
				alert(i18n("Cannot_add_more_free_products_than_allowed."));
				this._clearOthers();
				return false;
			}else {
				var obj = $('freeProductItems'+statusIndex);
				if(obj != null){
					try{
						this._setProductItemValues(obj,statusIndex);
					}catch(err){alert(err.message);}
				}
				return true;
			}
		}
		}
		return true;
	},

	_setAddonProductItemValues :function(thisObj,setIndex){
		var index = thisObj.selectedIndex;
		//alert($('freeItemImageURL_'+index).title);
		$('freeItemId'+setIndex).value = $('freeItemId_'+index).title;
		$('freeItemImageURL'+setIndex).value = $('freeItemImageURL_'+index).title;
		$('multileMRP'+setIndex).update($('freeItemMRPrc_'+index).title);
		$('multileOffer'+setIndex).update($('freeItemOfferPrc_'+index).title);
		//$('multileDiscount').update($('freeItemDiscount_'+index).title);
		$('freePodImg'+setIndex).src = $('freeItemImageURL_'+index).title;
		//alert($('freeItemImageURL_'+index).title);
		//alert($('freePodImg'+setIndex).src);
		
	},

	  // TODO another method has to be written for collecting messages in the format
	  // MessageProvided1,ItemID1,AttributeID1:MessageProvided2,ItemID2,AttributeID2:  
	  
	_setProductItemValues :function(thisObj,setIndex){
		var index = thisObj.selectedIndex;
		
		$('freeItemId'+setIndex).value = $('freeItemId_'+index).title;
		$('freeItemMRPrc'+setIndex).value = $('freeItemMRPrc_'+index).title;
		$('freeItemOfferPrc'+setIndex).value = $('freeItemOfferPrc_'+index).title;
		$('freeItemDiscount'+setIndex).value = $('freeItemDiscount_'+index).title;
		$('freeItemImageURL'+setIndex).value = $('freeItemImageURL_'+index).title;
		$('freeItemTitle'+setIndex).value = $('freeItemTitle_'+index).title;
		$('freeItemAMTName'+setIndex).value = $('freeItemAMTName_'+index).title;
		$('freeItemAMTPOI'+setIndex).value = $('freeItemAMTPOI_'+index).title;

		$('multileMRP'+setIndex).update($('freeItemMRPrc_'+index).title);
		$('multileOffer'+setIndex).update($('freeItemOfferPrc_'+index).title);
		//$('multileDiscount').update($('freeItemDiscount_'+index).title);
		$('freePodImg'+setIndex).src = $('freeItemImageURL_'+index).title;
	},
	
	
	_clearOthers : function (){
		/*User can select the radio button after the selection of checkbox*/
		var formEles = document.forms[this._formId].elements;
		for(var i=0; i<  formEles.length;i++)
		{
			var element = formEles[i];
			if(element.type == "checkbox" && element.checked)
				element.checked = false;
		}
	},
	_isValidQty : function(){
		var qtyObj = $('itemqty');
		if(qtyObj !=null && qtyObj.value != ''){
			if(isNaN(qtyObj.value))
			{
				alert(i18n("Not_a_valid_Number."));
				return false;
			}else if(parseInt(qtyObj.value) < 1 & parseInt(qtyObj.value) > 5){
					alert(i18n("Please_enter_value_below_to_6."));
				return false;
			}
		}else{
			alert(i18n("Please_enter_valid_quantity."));
			return false;
		}
		return true;
	},

	isCheckout : function(){
		var isValid = false;
		try{
				if($('pilrfnum') == null || $('pilrfnum').value == '' )
				{
					alert(i18n("This_Item_can_not_be_added.")); return false;
				}

				isValid = this._isAllAttributeSelected()
				if(!isValid){
					alert(i18n("Please_select_attribute_for_this_product."));
					return false;
				}

				isValid = this._checkMaxFreeProducts();
				if(!isValid)
					return false;

			/*	isValid = this._isValidQty();
				if(!isValid)
					return false; */
			  // This loop is for accumlating the items of the free products.
			  // The titles of the radio buttons will be 
			  // in the format -- PrimaryProductID$RelatedProductID$RelatedItemID --
			  // TO set the variables to no values for every method invocation.
			  //initializeVariables(formName);
			 
			  //this._addSecondaryRadioItems();
			 // this._addSecondaryNonRadioItems();
			  //this._getHiddenFieldValue();
			  //this._setMessageValues();
		  
	  }catch(exception){alert(exception.message)}
	  return isValid;
	},
	showFormId : function(){
		alert(this._formId);
	},
	openImages : function(){
	}
}// product Oject OO finished


	function updateProductPrice(){
		try{
		var allIsmpaoRfNum = '';
		var elems = document.forms['addToCartFrom'].elements;
		var attCnt = 0;
		for( var i=0; i<elems.length; i++)
		{
			if(elems[i].id.indexOf('attributesValue') !=-1 )
			{	if(elems[i].value != null && elems[i].value.length>0)
				{
					attCnt++;
					allIsmpaoRfNum   += elems[i].value + '#';
				}
			}
		}
		
		if(attCnt != $('attribCount').value )
			return false;
		
		var url = path+'/faces/tiles/components/product/itemPrice.jsp';
		
		var myAjax = new Ajax.Updater(
			'itemPriceDiv', 
			url, 
			{
				method: 'GET', 
				parameters: {'allAttribute':allIsmpaoRfNum,'catalogueId':$('mctrfnum').value},
				evalScripts : true,
				onFailure:handleFail
			});
		}catch(exception){alert(exception.message);return false;}
	}
	function handleImage(){
		if($('hideProdImg')){
			if($('hideProdImg').value != 'undefined' && $('hideProdImg').value!=''){
				$("mainImg").src = $('hideProdImg').value ;
				$("pbilimage1").value = $('hideProdImg').value ;

			}
		}
	}
	function checkPNo(e,obj,flag)
	{
		var unicode= e.charCode? e.charCode : e.keyCode;
		if ( unicode !=8 && unicode !=9 ){ //if the key isn't the backspace key (which we should allow)
			if (flag=='isNumber' && (unicode < 48 || unicode > 57)) {
				obj.focus();
				return false;				
			}
			if (flag=='isValidQty' && (obj.value < 1 || obj.value > 5)){
				alert(i18n("Please_Enter_Product_Quantity_Between_1_to_5."));
				obj.value="1";
				obj.focus();
				return false; //disable key press
			}
		}
	}
	function updateCart(isCart){
		var prod = new Product('addToCartFrom');
		if(!prod.isCheckout()){
			return false;
		}
		var url = path+'/faces/tiles/components/product/miniShoppingCart.jsp';
		if(isCart != null && isCart.length>0){
			
			/**
				Dont check for login while add to favorite.
			**/
			//var isLoginUser = $('_isLogged').innerHTML;
			var isLoginUser = "true";

			if(isCart=='Y' && isLoginUser=='false'){
				alert(i18n("Please_Login_First_To_Add_Product_In_Wish_List."));
				getLoginForm(path+'/faces/tiles/components/loginForm.jsp');
				return false;
			}
			else{
				$('isWishList').value= isCart;
				$('invoke:action').value = "BuyerMainNavigationActionBean.addToCartAction";
				var myAjax = new Ajax.Updater('minishoppingcart',url,
				{
					method: 'GET',	
					parameters: $('addToCartFrom').serialize(),
					onSuccess : updateCartSuccess,
					onFailure:handleFail
				});
			}	
		}
	}
	function updateCartSuccess(transport){
		if(transport.status == 200){
			updateErrorDiv(transport);
			updateFavouriteItemDIV();
			updateShoppingHeadPage();
		}
	}
	function addScheme(){
		var prod = new Product('addToCartFrom');
		if(!prod.isCheckout()){
			return false;
		}
		
		var qty = window.opener.document.getElementById('maxFree');
		var selQty = window.opener.document.getElementById('_selected');	
		if(selQty.value >= qty.value ){
			alert(i18n("Cannt_add_more_products"));
			return false;
		}
		$('invoke:action').value = "BuyerMainNavigationActionBean.addToSchemeAction";
		var myAjax = new Ajax.Request("addScheme.jsp",
		{
			method: 'POST',	
			parameters: $('addToCartFrom').serialize(),
			onSuccess : function(){selQty.value = ++selQty.value},
			onFailure:handleFail
		});
	}
	function handleFail(request){
		alert(i18n("Sorry_there_was_an_error"));
	}
	
	function changeMiscInfo(sourceId){
		var o_targetDiv = "miscellaneous";
		$(o_targetDiv).innerHTML="";
		$(o_targetDiv).innerHTML = $(sourceId).innerHTML;
		//alert("sourceID===>"+sourceId);
		//footerBottom();
	}
	function sendParamsForAddonProducts(productId,catalogueID,categoryID)
	{
		
		try{
			var url = path + "/faces/tiles/components/product/relatedProducts.jsp";
			var params = null;
			params =  {'invoke:action': 'RelatedProductsFiller.relatedProducts_init','productID':productId,'catalogueID':catalogueID,'categoryID':categoryID};
			var myAjax = new Ajax.Updater(
				'addonPrd', 
				url, 
				{
					method: 'GET', 
					parameters: params,
					//onSuccess:showResponsex,
					onFailure:handleFail
				});
		}catch(exception){
			alert(exception.message);
		}
	}

	function openImages(productId,catalogueID,ctx)
	{
		//alert("productId-->"+productId+"catalogueID-->"+catalogueID)
		var zoomImgId = document.getElementById("zoomImgPitId").value;
		var page = ctx ;
		if(productId==null)
		{
			alert(i18n("Please_Select_Item."));
		}else
		{
			page += "/faces/tiles/productImages.jsp?productID="+productId+"&catalogueID="+catalogueID+"&zoomImageId="+zoomImgId;
			var win_porp = "location=no, toolbar=no, location=no, status=no, menubar=no, scrollbars=Yes, resizable=no,height=650,width=850,left=100,top=0px";
			window.open(page, "pImages",win_porp);
		}
	}
	function findAtStoreCheck(catid,prdid){
		var itemSize = $('selectedItemSizeText').innerHTML;
		var itemSizeAfterTrim =itemSize.trim();		
		var productDiscount = $('productDiscount').value;
		 if(itemSize == ''){
         alert(i18n("Please_select_item_size"));
		 return false;
		}
		else{
			window.location.href=path+"/faces/jsp/storeLocator.jsp?productID="+prdid+"&catalogueID="+catid+"&itemSize="+itemSizeAfterTrim+"&productDiscount="+productDiscount;
		}
	}
	function goToSimpleAddress()
	{
		var itemSize = $('selectedItemSizeText').innerHTML;
		
		if(itemSize == ''){
         alert(i18n("Please_select_item_size."));
		 return false;
		}
		var prod = new Product('addToCartFrom');
		//alert("this is called");
		if(!prod.isCheckout())
			return false;
			
		$('isWishList').value= "N";
		$('invoke:action').value = "BuyerCheckoutActionBean.checkoutAction";
		$('addToCartFrom').action = path + '/faces/jsp/ccsimpleAddress.jsp';
		$('addToCartFrom').submit();

	}
	/**
	This will change the main image of the product when user click on the small images
	*/
	function changeMainImg(newImg,which,zoomPitId)
	{	

		var form = document.forms[0];
		var ele =null;
		if(which=='main')
		{
			ele = document.getElementById("mainImg");
			ele.src = newImg;
			//document.getElementById('divImage').src=ele.src;
		}else{
		ele = document.getElementById("popupedLargeImg");
		ele.src = newImg;
		//document.getElementById('divImage').src=ele.src;
		}
		if(document.getElementById("zoomImgPitId")){
			document.getElementById("zoomImgPitId").value = zoomPitId;
		}
		
	}
	function checkUserLoginForReview(){
		if($('_isLogged') != null && $('_isLogged').innerHTML == 'false'){
				alert(i18n("Please_Login_to_write_reviews."));
				getLoginForm(path + '/faces/tiles/components/loginForm.jsp');
				return false;
		}
		return true;
	}
	function processReview(ctx,reviewType,pid,sid,action) {
		var path = ctx ;
		var reviewPage = '';
		var params = '';
		var formName = '';
		if(reviewType == 'writeProductReviewFlag' && pid != null){
			/**
				Check Login For Write Product Review. 
				'chkLoginForReview' variable is the last hidden field on productDisplay.jsp
				Value to "chkLoginForReview" will get set as per "productDisplay_en.properties".
			*/
			if ($('chkLoginForReview').value == 'true' && !checkUserLoginForReview()) {
				return false;
			}
			if(action == 'showReviewForm'){
				params = {'pbirfnum':pid};	
			}
			if(action == 'saveReview'){
				if(!validateProductReview()){
					return false;
				}
			}
			path += "/faces/jsp/writeProductReview.jsp";
			formName = 'writeProductReview';
		}
		else if(reviewType == 'writeSellerReviewFlag' && sid != null){
			/**
				Guest User can never give review to the seller. 
				Because as per bussiness logic one user means ubirfnum can give one and only one review to the review.
			*/
			if (!checkUserLoginForReview()) {
				return false;
			}
			if(action == 'showReviewForm'){
				params = {'ssirfnum':sid};	
			}
			if(action == 'saveReview'){
				if(!validateSellerReview()){
					return false;
				}
			}
			path += "/faces/jsp/writeSellerReview.jsp";
			formName = 'writeSellerReview';
		}
		else if(reviewType == 'viewSellerReviewsFlag' && sid != null){
			path +="/faces/jsp/sellerInfo.jsp";
			params = {'ssirfnum':sid};	
		}	
		if(action == 'showReviewForm'){
			$('ratingFormDiv').innerHTML = '';
			var myAjax = new Ajax.Updater('ratingFormDiv',path, 
			{
				method: 'GET',
				parameters: params,
				onSuccess : showReviewFormResponse,
				onFailure:handleFail
			});
		}
		else if(action == 'saveReview'){
			var myAjax = new Ajax.Updater('ratingFormDiv',path, 
				{
					method: 'POST', 
					parameters: $(formName).serialize(),
					onSuccess : saveReviewResponse,
					onFailure : handleFail
				});
		}
		return false;
}

function showReviewFormResponse(transport){
	if(200 == transport.status){
		if(transport.responseText.indexOf('sellerReviewErrorDIV') != -1){
			alert(i18n("You_have_already_reviewed_this_seller."));
		}
	}
}
function saveReviewResponse(transport){
	if(200 == transport.status){
		alert(i18n("Review_published_successfully."));
		window.location.reload();
	}
}
function validateProductReview(){
	/*var name = $('userName').value;
	if(!alphaCharWithSpace(trimValue(name))){
		alert(i18n("Please_Enter_Valid_User_Name."));
		$('userName').focus();
		return false;
	}
	if(!($('prtowneproductY').checked || $('prtowneproductN').checked)) {
		alert(i18n("Please_select_Have_you_purchased_this_product_option."));
		$('prtowneproductY').focus();
		return false;
	}*/
	
	var count = 0;
	var paramCount = 0;
	var list = document.writeProductReview.elements;
	/*for(var i = 0 ; i < list.length ; i++){
		if(list[i].type=="radio" && list[i].name.indexOf('prtrating')!=-1){
			if(list[i].checked){
				count++;				
			}
			paramCount++;
		}
	}
	paramCount = paramCount/5;
	if(count != paramCount){
		if(paramCount == 1){
			alert(i18n("Please_give_rating."));	
		}
		else{
			alert(i18n("Please_give_rating_for_all_attribute."));
		}
		return false;
	}*/
	var starRatings = $('prtrating1').value; 
	if(starRatings == 0){
		alert(i18n("Please_give_rating."));	
		return false;
	}
	var review = trimValue($('prtreviewpro').value);
	if(review == ''){
		alert(i18n("Please_Enter_Your_review."));
		$('prtreviewpro').focus();
		return false;
	}
	else if(review.length > 1024){
		alert(i18n("Review_Must_Have_Less_Than_1024_Character."));
		$('prtreviewpro').focus();
		return false;
	}
	
	var text1 =  $('generatedText').innerHTML;
	var text2 = $('enteredText').value;
	
	text1 = text1.toUpperCase(text1)
	text2 = text2.toUpperCase(text2);
	
	if(text1 != text2){
		alert(i18n("Please_enter_valid_security_code"));

		$('enteredText').focus();
		return false;
	}
	
	return true;
}


function validateSellerReview(){
	var name = $('userName').value;
	if(!alphaCharWithSpace(trimValue(name))){
		alert(i18n("Please_Enter_Valid_User_Name."));
		$('userName').focus();
		return false;
	}
	if(!($('srtboughtproductY').checked || $('srtboughtproductN').checked)) {
		alert(i18n("Please_select_Have_you_purchased_this_product_option."));
		$('prtowneproductY').focus();
		return false;
	}
	var list = document.writeSellerReview.elements;
	var flag = true;
	for(var i = 0 ; i < list.length ; i++){
		if(list[i].type=="radio" && list[i].name.indexOf('srtrating1')!=-1){
			if(list[i].checked){
				flag = false;
				break;
			}
		}
	}
	if(flag) {
		alert(i18n("Please_give_rating."));
		$('srtrating1').focus();
		return false;
	}	
	var review = trimValue($('srtreviewpro').value);
	if(review == ''){
		alert(i18n("Please_Enter_Your_review."));
		$('srtreviewpro').focus();
		return false;
	}
	else if(review.length > 1024){
		alert(i18n("Review_Must_Have_Less_Than_1024_Character."));
		$('srtreviewpro').focus();
		return false;
	}
	return true;
}


function setRankingStar(feed,hook,ratingFor)
{
	feed = feed/10;
	var star = Math.round(feed);
	var temp = star;
	var totalStar = 5;
	var fadStar = 0;
	var fullStar = 0;
	var halfStar = 0;
	star = star % 2;
	if(star == 0)
	{
		fullStar = feed / 2;
		halfStar = 0;
	}
	else
	{
		if(feed % 0.5 == 0){
			fullStar = Math.floor(feed / 2);
			halfStar = 1;
		}
		else if(feed < temp){
			fullStar = Math.floor(feed / 2);
		}
		else if(feed > temp){
			fullStar = Math.ceil(feed / 2);
		}

	}
	
	fadStar = totalStar - (fullStar + halfStar);
	
	var fargment = document.createDocumentFragment();
	fargment.appendChild(document.createTextNode(ratingFor))
	var image = null;
	
	for(var i = 1 ; i<= fullStar; i++)
	{
		image = document.createElement("IMG");
		image.src = staticPath+"/media/images/OctaShop/star_1.gif";
		
		image.id=""+i
		fargment.appendChild(image);
		
	}
	
	if(halfStar > 0)
	{
		image = document.createElement("IMG");
		image.src = staticPath+"/media/images/OctaShop/star_2.gif";
		image.id=""+i
		fargment.appendChild(image);
	}
	for(var i = 1 ; i<= fadStar; i++)
	{
		image = document.createElement("IMG");
		image.src = staticPath+"/media/images/OctaShop/star_3.gif";
		image.id=""+i
		fargment.appendChild(image);
	}
	var starTag = document.getElementById(hook);
	starTag.appendChild(fargment);
}
function ajaxProductRating(id,val)
{
	var url = path+'/faces/tiles/components/latestUserRatings.jsp';
	var userRating = new Ajax.Updater('p_userRating', 
		url, 
		{
			method: 'GET', 
			parameters: {'productID':$F('pbirfnum'),'pn':val,'rpp':5,'invoke:action':'LatestUserRatingsActionBean.getLatestUserRatings'},
			onFailure:handleFail
		});
}
function setRelatedPbiRfNum(isCart){
	//alert("stated");
	var pbis="";
	var temppbis="";
	var pils="";
	if(isCart=='Y'){
	var list = document.getElementsByTagName('input');
	var count=0;
	for(var i=0;i<list.length;i++){
		 
		if(list[i].type=="checkbox" && list[i].id.indexOf("related_chk_box") != -1 && list[i].checked){
			var chkID = list[i].id;
			pbis = pbis + chkID.substring(chkID.indexOf("@")+1,chkID.length) + "#@";
			temppbis = chkID.substring(chkID.indexOf("@")+1,chkID.length)+"@";
			//alert("________________  "+$('freeItemId'+count).value);
			pils=pils+temppbis+$('freeItemId'+count).value+"#";
			count++;
			//alert(pils);
		}
		if(list[i].type=="checkbox" && list[i].id.indexOf("related_chk_box") != -1 && count==0){
		//alert("count");
		count++;
		}
	}
	if(pbis != ""){
		pbis = pbis.substring(0,pbis.length-2);
	$('relatedProductsPbis').value = pbis;
	}
		
	if(pils!=""){
	pils = pils.substring(0,pils.length-1);
	$('relatedProductsPils').value = pils;
	}
	}
	//alert(pbis);
	//alert("############"+pils);
}

function moveImg(flag,divName,divClickCountVar){
	var nextDivCnt = "";
	var currentDiv = $(divClickCountVar).value;
	if(flag == 1){			
		nextDivCnt = parseInt(currentDiv) + parseInt(4);
		if($(divName+'_'+nextDivCnt)){
			$(divName+'_'+currentDiv).style.display = 'none';
			$(divName+'_'+nextDivCnt).style.display = 'block';
			$(divClickCountVar).value = nextDivCnt;
			$('prev'+divName).className = "prevActive";
			if(!$(divName+'_'+(parseInt(nextDivCnt)+parseInt(4)))) {
				$('next'+divName).className = "nextDActive";	
			}
		}
	}
	if(flag == -1){
		nextDivCnt = parseInt(currentDiv) - parseInt(4);
		if(nextDivCnt >= 0 && $(divName+'_'+nextDivCnt)){
			$(divName+'_'+currentDiv).style.display = 'none';
			$(divName+'_'+nextDivCnt).style.display = 'block';
			$(divClickCountVar).value = nextDivCnt;
			$('next'+divName).className = "nextActive";
			if(!$(divName+'_'+(parseInt(nextDivCnt)-parseInt(4)))) {
				$('prev'+divName).className = "prevDActive";
			}
		}
	}
}

function movePrdViewImg(flag,divName,divClickCountVar){
	var viewImageId = "";
	var hideDivCnt = "";
	var hideDivId = "";
	var nextDivId = "";
	var nextDivCnt = "";
	var currentDiv = $(divClickCountVar).value;
	var currentDivId = divName+'_'+currentDiv;
	if(flag == 1){			
		nextDivCnt = parseInt(currentDiv) + parseInt(1);
		nextDivId = divName+'_'+nextDivCnt;
		viewImageId = "img_" + nextDivId;
		if($(nextDivId)){
			$(viewImageId).click();
			$(nextDivId).className = "activeImage_class";
			$(currentDivId).className = "image_class";
			if($(nextDivId).style.display != 'block'){
				hideDivCnt = parseInt(nextDivCnt) - parseInt(4);
				hideDivId = divName+'_'+hideDivCnt;
				$(hideDivId).style.display = 'none';
				$(nextDivId).style.display = 'block';				
			}		
			$('prev'+divName).className = "prevActive";
			if(!$(divName+'_'+(parseInt(nextDivCnt)+parseInt(1)))) {
				$('next'+divName).className = "nextDActive";	
			}
			$(divClickCountVar).value = nextDivCnt;
		}
	}
	if(flag == -1){
		nextDivCnt = parseInt(currentDiv) - parseInt(1);
		nextDivId = divName+'_'+nextDivCnt;
		viewImageId = "img_" + nextDivId;
		if(nextDivCnt >= 0 && $(nextDivId)){
			$(viewImageId).click();
			$(nextDivId).className = "activeImage_class";
			$(currentDivId).className = "image_class";
			if($(nextDivId).style.display != 'block'){
				hideDivCnt = parseInt(nextDivCnt) + parseInt(4);
				hideDivId = divName+'_'+hideDivCnt;
				$(hideDivId).style.display = 'none';
				$(nextDivId).style.display = 'block';		
			}
			$('next'+divName).className = "nextActive";
			if(!$(divName+'_'+(parseInt(nextDivCnt)-parseInt(1)))) {
				$('prev'+divName).className = "prevDActive";
			}
			$(divClickCountVar).value = nextDivCnt;
		}
	}
} 
function resetSize(){
	var selectedItemSize = document.getElementById('itemSize').value;
	if(selectedItemSize != ''){
		document.getElementById('size_'+selectedItemSize).className = 'activeitemSize';
	}
	document.getElementById('hiddenItemSize').value = "";
	document.getElementById('itemSize').value = "";
	document.getElementById('attr_Size').value = "";
	document.getElementById('selectedItemSizeText').innerHTML = "";
	var list = document.getElementsByTagName('input');
	for(var i =0 ; i < list.length; i++){
		if(list[i].className == 'selectitemSize'){
			list[i].className = 'activeitemSize';
		}
	}
}
function setItemSize(itemSize,obj){
	document.getElementById('hiddenItemSize').value = itemSize;
	document.getElementById('itemSize').value = itemSize;
	document.getElementById('attr_Size').value = itemSize;
	document.getElementById('selectedItemSizeText').innerHTML = "  " +itemSize;
	var list = document.getElementsByTagName('input');
	for(var i =0 ; i < list.length; i++){
		if(list[i].className == 'selectitemSize'){
			list[i].className = 'activeitemSize';
		}
	}
	//document.getElementById('size_'+itemSize).className = 'selectitemSize';
	obj.className = 'selectitemSize';
}
/* This function is used for star ratings. */
function setRate(id,show_imgno,flag){
	
	if(flag == "1"){//onclick
		val = id.substring(0,id.length-1);	
		for (ui=1;ui<=5;ui++){
		   mobj=document.getElementById(val + ui);
		   mobj.onmouseout="";	 
		   mobj.onmouseover="";				   
		   if (ui<=show_imgno){ 
			   mobj.src="/media/images/OctaShop/star_1.gif"				
		   }else{
			   mobj.src="/media/images/OctaShop/star_3.gif"				
		   }
		}			 
		document.getElementById('prtrating1').value=show_imgno;
	}

	if(flag == "2"){//onmouseout
		val = id.substring(0,id.length-1);
		for (ui=1;ui<=5;ui++){
		   mobj=document.getElementById(val+ui);
		   mobj.src="/media/images/OctaShop/star_3.gif"
		}
	}

	if(flag == "3"){//onmouseover
		val = id.substring(0,id.length-1);     
		for (ui=1;ui<=5;ui++){                                                           
			mobj=document.getElementById(val+ui); 
			if (ui<=show_imgno){
					mobj.src="/media/images/OctaShop/star_1.gif"
			}else{
					mobj.src="/media/images/OctaShop/star_3.gif"
			}
		}
	}

	if(flag == "4"){//ondblclick
		var t = document.getElementById("prtrating1");
		if(t.value == 1){
			t.value = "";
		}
		mobj=document.getElementById(id);                                    
		mobj.src="/media/images/OctaShop/star_3.gif"
	}	

}

function checkPNo3(e,obj,flag)
	{
		var unicode= e.charCode? e.charCode : e.keyCode;
		if ( unicode !=8 && unicode !=9 ){ //if the key isn't the backspace key (which we should allow)
			if (flag=='isNumber' && (unicode < 48 || unicode > 57)) {
				obj.focus();
				return false;				
			}
			if (flag=='isValidQty' && (obj.value < 1 || obj.value > 3)){
				alert(i18n("Please_Enter_Product_Quantity_Between_1_to_3."));
				obj.value="1";
				obj.focus();
				return false; //disable key press
			}
		}
	}

