
var checkingfor = '';
var whatprocess = new Array();
var addComment = 0;
function checkSession(frmobj)
{
    //frmobj="";
	$cs = jQuery.noConflict();
	$cs.post(basePath+"/internal/login/checksession",{},function(data){
		if(trim(data) == ""){
			html = '';
			html += "<form name='frmlogin' id='frmlogin' method='post' action='' ><table border='0' cellpadding='2' cellspacing='1' width='100%'>";
			html += "<tr><td colspan='2' nowrap='nowrap' align='center'><strong>You are not loggedIn. So, first login and try again.</strong></td></tr>";
			html += "<tr><td align='right' height='28'>Email : </td>";
			html += "<td ><input name='Email' id='Email' class='input' type='text' value='' alt='*{E}' size='33' title='Email' /> </td></tr>";
			html += "<tr><td height='28' align='right'>Password : </td>";
			html += "<td><input name='Password' id='Password' type='password' value='' class='input' size='33' title='Password' alt='*' /></td></tr>";
			html += "<tr><td align='right'>&nbsp;</td>";
			html += "<td height='22'><input type='submit' class='button'   border='0' onclick='return validation(document.frmlogin);' style='cursor:pointer;' value='Login' /></td></tr>";
			html += "<tr><td align='right'>&nbsp;</td>";
			html += "<td height='22'><a href='"+basePath+"/member/register'>New Member? Click Here To Register</a></td></tr>";
			html += "</table></form>";

			$cs('#hiddenDialogText').html(html);
			tb_show("Login.","#TB_inline?height=150&width=350&inlineId=hiddenDialogText&modal=true", false);

			if(checkingfor == 'WriteReview' || checkingfor == 'VideoReview' || checkingfor == 'AddComment' || checkingfor == 'createPriceAlert' || checkingfor == 'TagTheProduct' || checkingfor == 'NomitedCrown' || checkingfor == 'AddToFavourite' || checkingfor == 'openWishBox' || checkingfor == 'AddToFavoriteProduct' || checkingfor == 'AddTopicDetail' || checkingfor == 'AddReportAbuse'){
   			}else if(checkingfor == 'WriteReviewTab'){
   				$cs("#writeReviews").hide();
   			}
			return false;
		}else{
			//alert(checkingfor);return false;s
			if(checkingfor == 'WriteReview'){
				var vTitleReview = frmobj.vTitleReview.value;
				var iOverallRate = frmobj.iOverallRate.value;
				var iAccuracyRate = frmobj.iAccuracyRate.value;
				var iValueForMoney = frmobj.iValueForMoney.value;
				var eRecommend = $cs(frmobj).find('input[name=eRecommendW]:checked').val();
				var tReview = frmobj.tReview.value;
				var vAdvantage = frmobj.vAdvantage.value;
				var vDisadvantage = frmobj.vDisadvantage.value;
				var vSummary = frmobj.vSummary.value;
				var mode = frmobj.mode.value;
				var iProductId = frmobj.iProductId.value;

				if(vTitleReview==""){
					alert("Please enter title.");
					$cs("#vTitleReview").focus();
					return false;
				}else if(iOverallRate=="0"){
					alert("Please give rate of Overall Rate.");
					$cs("#iOverallRate").focus();
					return false;
				}else if(iAccuracyRate=="0"){
					alert("Please give rate of Accuracy Rate.");
					$cs("#iAccuracyRate").focus();
					return false;
				}else if(iValueForMoney=="0"){
					alert("Please give rate of Value For Money.");
					$cs("#iValueForMoney").focus();
					return false;
				}else if(tReview==""){
					alert("Please enter Review.");
					$cs("#tReview").focus();
					return false;
				}else if(tReview.length < min_review_w_point_limit){
					alert("Please enter minimum "+min_review_w_point_limit+" characters for Review.");
					$cs("#tReview").focus();
					return false;
				}else if(vAdvantage==""){
					alert("Please enter Advantage.");
					$cs("#vAdvantage").focus();
					return false;
				}else if(vDisadvantage==""){
					alert("Please enter Disadvantage.");
					$cs("#vDisadvantage").focus();
					return false;
				}else if(vSummary==""){
					alert("Please enter Summary.");
					$cs("#vSummary").focus();
					return false;
				}
				$cs('#writereviewTr').html('<div style="text-align:center"><img src="'+basePath+'/images/ajax-loader.gif " /></div>');
        		$cs.post(basePath+"/product/front/writereview/1",{"vTitleReview":vTitleReview,"iOverallRate":iOverallRate,"iAccuracyRate":iAccuracyRate,"iValueForMoney":iValueForMoney,"eRecommend":eRecommend,"tReview":tReview,"vAdvantage":vAdvantage,"vDisadvantage":vDisadvantage,"vSummary":vSummary,"mode":mode,"iProductId":iProductId},function(data){
					//alert(data);
					window.location.reload();
					//$("#var_msg").html(data);
					//$("#writereviewTr").hide();
					//$.hideprogress();
					hideWriteReview = document.getElementById("hideWriteReview").value;
					hideisLogin = document.getElementById("hideisLogin").value;
					resetwriteReview(hideWriteReview,hideisLogin);
					 
				});
			}
			else if(checkingfor == 'VideoReview'){
				vTitleReview = frmobj.vTitleReview.value;
				var eVideoType = frmobj.eVideoType.value;
				var vVideoFile = frmobj.vVideoFile.value;
				var vDescription = frmobj.vDescription.value;

				result = true;
				if(vTitleReview==""){
					alert("Please enter title.");
					frmobj.vTitleReview.focus();
					return false;
				}else if(vVideoFile==""){
					alert("Please "+$("#vVideoFile").attr("title"));
					$("#vVideoFile").focus();
					return false;
				}else if(vDescription==""){
					alert("Please enter Description.");
					$("#vDescription").focus();
					return false;
				}
				if(eVideoType=="File"){
					var validExtension = video_ext;
					result = checkValidFile('Yes',vVideoFile,validExtension)
				}
				if(result){
                   
					frmobj.submit();
					//ajaxFileUpload(frmobj);
					//alert('function call');
					//alert("Video reviews added successfully.");
					//window.location.reload();
					//resetvideoReview(frmobj,document.getElementById("hideVideoReview").value,document.getElementById("hideisLogin").value);
					
					
				}
				return false;
			}else if(checkingfor == 'WriteReviewTab'){
   				showHideExt("File");
				resetwriteReview(document.getElementById("hideWriteReview").value,document.getElementById("hideisLogin").value)
				resetvideoReview(document.frmvideoreview,document.getElementById("hideVideoReview").value,document.getElementById("hideisLogin").value);
				$("#writeReviews").show();
				
   			}else if(checkingfor == 'AddComment'){
   				if(document.getElementById("vComment").value==""){
					alert("Please Enter Comment");
					document.getElementById("vComment").focus();
					return false;
				}
				var vComment=document.getElementById("vComment").value
				 eRecommend=document.getElementById("rec").value
				//var iReviewerId=document.getElementById("iReviewerId").value
                                
				$.post(basePath+"/member/index/AddComment/1",{"reviewid":whatprocess[0],"productid":whatprocess[1],"comment":vComment,"recommend":eRecommend,"reviewrid":whatprocess[2]},function(data){
					dataarr = data.split("#");
					
					$('#vComment').attr('value',vComment);
					$('#imgRatValueId').html(dataarr[0]);
					$('#eRecommendImageId').attr('src',dataarr[1]);
					alert("Comment added Successfully.");
                                        window.location.reload(true);
					showReviewsComments(whatprocess[0]);
				});
   			}else if(checkingfor == 'createPriceAlert'){
   				$.post(basePath+"/product/ajax/createpricealert/1",{"ProductId":whatprocess[0],"Price":whatprocess[1]},function(data){
   					
                                        if(data==0){
						alert("Price alert is already created for this product.");
					}else{
						alert("Price alert for this product is created successfully.");
					}
				});
   			}else if(checkingfor == 'TagTheProduct'){
   				iProductId = document.getElementById("iProductId").value;
				var TagComment = document.getElementById("TagComment").value;
				if(document.getElementById("TagComment").value == ""){
					alert("Please enter tag for product.");
					document.getElementById("TagComment").focus();
					return false;
				}
				$.post(basePath+"/product/ajax/TagTheProduct/1",{"ProductId":iProductId,"Tag":TagComment},function(data){
					document.getElementById("TagComment").value="";
					if(data!=0){
                                        alert("Tag for the product added successfully as pending, Once Admin will approve, it will be display on site");
                                        }
                                        else
                                        {
                                            alert("Tag already exits please choose another tag");
                                        }
				});
   			}else if(checkingfor == 'NomitedCrown'){
   				iRatingId = whatprocess[0];
   				AddCrownHTML(iRatingId);					
				}
   			else if(checkingfor == 'AddToFavourite'){
   				iRatingId = whatprocess[0];
   				AddFavouriteHTML(iRatingId);
			}else if(checkingfor == 'AddToFavoriteProduct'){
                            
   				ProductId = whatprocess[0];
   				AddFavouriteForProductHTML(ProductId);
			}else if(checkingfor == 'openWishBox'){
                            
   				//var combo = document.getElementById("wishlistcombo").cloneNode(true);
                                
		        html = "";
		        html += "<table border='0' cellpadding='2' cellspacing='1' width='100%'>";
		        html += "<tr><td><strong>My Wish List :</strong></td>";
		        html += "<td id='wishTd'>";
		        html += "</td></tr><tr><td colspan='2'>&nbsp;</td></tr>";
		        html += "<tr><td colspan='2' align='center'><a href='javascript://' onclick='openwishlist()' class='grayboldlink'>Create New Wish list</a></td></tr>";
		        html += "<tr><td valign='top'>&nbsp;</td><td align='left'><input type='image' src='"+basePath+"/images/btn-submit.gif' class='noinput' onclick='saveProductToWishList(\""+whatprocess[0]+"\")'></td></tr>";
		        html += "</table>";

		        $.post(basePath+"/product/ajax/WishCombo/1",{},function(data){
		        	
                                $("#wishTd").html(data);
				});

		        $('#hiddenDialogText').html(html);
				/*$(combo).attr("name","mywishcombo");
		        $(combo).attr("id","mywishcombo");
		        $("#wishTd").html($(combo));*/

		        tb_show("Add to My Wish List", "#TB_inline?height=120&width=310&inlineId=hiddenDialogText&modal=true", false);
			}else if(checkingfor == 'AddTopicDetail'){
				iForumCategoryId = whatprocess[0];
				AddTopicHTML(iForumCategoryId);
			}else if(checkingfor == 'AddCommentTopic'){
				iForumTopicId = whatprocess[0];
				eType = whatprocess[1];
				AddCommentTopicHTML(iForumTopicId,eType);
			}else if(checkingfor == 'EditCommentTopic'){
				iForumCommentId = whatprocess[0];
                                iForumCategoryId = whatprocess[2];
				eType = whatprocess[1];
                                 $.post(basePath+"/forum/ajax/editcomment/"+iForumCommentId,{},function(data){
		        	EditCommentTopicHTML(iForumCommentId,eType,data,iForumCategoryId);
				});
				
			}else if(checkingfor == 'AddReportAbuse'){
				
                                iForumTopicId = whatprocess[0];
				eType = whatprocess[1];
				AddReportAbuseHTML(iForumTopicId,eType);
			}
			return true;
		}
	});
$ = jQuery.noConflict();
}

function frmsubmitlogin(frm){

	var val = validate(frm);
    if(val==false){
        return false;
    }

    var email = document.getElementById("Email").value;
    var password = document.getElementById("Password").value;
    $.post(basePath+"internal/login",{"Email":email,"Password":password},function(data){
		if(data==-1){
			alert("Your login temporarily inactivated - Please contact Administrator.");
		}else if(data==0){
			alert("Email and/or Password are wrong which You have entered.");
		}else if(data==1){
			$("#tdRegisterId").css('display','none');
			$("#logintd").css('display','none');
			$("#logouttd").css('display','');

			tb_remove();
		}
    });
}

     function isValidEmailAddress(emailAddress) {
 		var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
 		return pattern.test(emailAddress);
	}
 function validation()
 {
     var email=$('#Email');
     var password=$('#Password');

     if(email.val()=='')
         alert("Please provide username");
     else if(password.val()=='')
        alert("Please provide password");

    else {
        if (isValidEmailAddress(email.val()))
            {
                $.post(
            basePath+"/internal/login",
            {"Email":email.val(),"Password":password.val()},
             function(data){
                    if(data==-1){
			alert("Your login temporarily inactivated - Please contact Administrator.");
		}else if(data==0){
			alert("Email and/or Password are wrong which You have entered.");
		}else if(data==1){
			$("#tdRegisterId").css('display','none');
			$("#loginlink").attr("href", basePath+"/member/login/logout").text("Logout");
                        tb_remove();
                        if(addComment == 1){
                        
                        checkingfor = "AddComment";
                        checkSession('');

                        }
                        else{
                        window.location.reload(true);
                        }
		}
            }
    );//end of ajax call
            }
        else
            {
                alert("Please enter a valid email address");
            }
    }


   return false;
 }

    function showReviews(val,productId,extra_param){
        if(extra_param==undefined)
            extra_param='';
        else
            extra_param = decode64(extra_param);

        extra_param += "";
		$('#showReviewDetail').html('<div style="text-align:center"><img src="'+basePath+'/images/ajax-loader.gif " /></div>');
        $.post(basePath+"/product/ajax/reviews/1",{"ePage":"Detail","iProductId":productId,"eStatus":val+extra_param},function(data){
            $("#showReviewDetail").html(data);
			//$.hideprogress();
		});
    }
	function showprofileReviews(MemberId,page){
        if(page==undefined) page=1;
		$('#showReviewDetail').html('<div style="text-align:center"><img src="'+basePath+'/images/ajax-loader.gif " /></div>');
        $.post(basePath+"/member/profile/reviews/1/"+page,{"ePage":"Detail","MemberId":MemberId,"eStatus":MemberId},function(data){
            $("#showReviewDetail").html(data);
			//$.hideprogress();
		});
    }

    /*function showReviewsComments(iRatingReviewId,extra_param){
        if(extra_param==undefined)
            extra_param='';
        else
            extra_param = decode64(extra_param);

        extra_param += "";
        $.post(basePath+"/ajax/showReviewsComment",{"iRatingReviewId":iRatingReviewId+extra_param},function(data){
            $("#viewCommentId").html(data);
            $("#BackToReviewId").css('display','');
        });
    }*/

    function showReviewsReader(id){
        $.post("http://www.comparereviews.co.uk/ajax/showReviewsReader",{"iRatingReviewId":id},function(data){
            showReviewsDetail(id);
        });
    }

    function showReviewsDetail(id){
        $("#BackToReviewId").css('display','none');
        $("#viewCommentRightId").css("display","none");
		$.post("http://www.comparereviews.co.uk/ajax/showReviewsDetail",{"iRatingReviewId":id},function(data){
            $("#showReviewDetail").html(data);
            showReviewsCommentRightHTML(id);

        });
    }

    //  This function is used for add to favourite for product...
	function writereviewtest(){
		alert("123");
		checkingfor = "WriteReview";
		checkSession('');
		}
	
	function AddToFavoriteProduct(ProductId){


        whatprocess[0]=ProductId;
		checkingfor = "AddToFavoriteProduct";
        checkSession('');
    }

    function AddFavouriteForProductHTML(ProductId){

        call_wait_div();
        html = "";
        html += "<table border='0' cellpadding='2' cellspacing='1' width='100%'>";
        html += "<tr><td nowrap='nowrap' align='center'><strong>Do you want to add this product to your Favourities?</strong></td></tr><tr><td height='5'></td></tr>";
        html += "<tr><td align='center'><input type='image' src='"+basePath+"/images/btn-add.gif' class='noinput' onclick='AddToFavoriteForProduct("+ProductId+")'>&nbsp;&nbsp;&nbsp;<input type='image' src='"+basePath+"/images/btn-cancel.gif' class='noinput' onclick='return tb_remove()'></td></tr>";
        html += "</table>";
        $('#hiddenDialogText').html(html);
        tb_show("Add To Favourite", "#TB_inline?height=80&width=375&inlineId=hiddenDialogText&modal=true", false);
    }

    function AddToFavoriteForProduct(id){
    	$.post(basePath+"/product/ajax/favoriteproduct/1",{"ProductId":id},function(data){
    		if(data == 0){
            	msg = 'This product is already exits in your favorite list.';
                tb_remove();
                setTimeout('alert(msg)',2000);
            }else{
                msg = 'Product is added to your Favorite list';
                tb_remove();
                setTimeout('alert(msg)',2000);
            }
        });
    }
    function countRate(n,imgId)
    {
        rate = document.getElementById(imgId).value;
        if(rate <= n){
            for(i=0;i<n;i++)
                {//alert(imgId+i);
                document.getElementById(imgId+i).src = basePath+'/images/orange-star.gif';}
        }
        if(rate > n){
            for(j=4;j>=n;j--)
                document.getElementById(imgId+j).src = basePath+'/images/blue-star.gif';
        }
        document.getElementById(imgId).value=n;
    }

    function checkRate(n,imgId){
		rate = document.getElementById(imgId+'Check').value;
		rateCount = document.getElementById(imgId).value;
		if(rateCount>n){
			for(i=0;i<rateCount;i++)
	            document.getElementById(imgId+i).src = basePath+'/images/orange-star.gif';
		}else{
	        if(rate <= n){
	            for(i=0;i<n;i++)
	                document.getElementById(imgId+i).src = basePath+'/imagesorange-star.gif';
	        }
	        if(rate > n){
	            for(j=4;j>=n;j--)
	                document.getElementById(imgId+j).src = basePath+'/images/blue-star.gif';
	        }
	        document.getElementById(imgId+'Check').value=n;
        }
    }

    function blankRate(blankId){
    	rateCount = document.getElementById(blankId).value;
    	if(rateCount!=0){
    		for(i=0;i<rateCount;i++)
	            document.getElementById(blankId+i).src = basePath+'/images/orange-star.gif';
	        rateLess = 5-rateCount;
			if(rateLess>0){
				for(k=i,j=rateLess;j>0;j--,k++)
	        		document.getElementById(blankId+k).src = basePath+'/images/blue-star.gif';
			}
    	}else{
    		for(i=0;i<5;i++)
	        	document.getElementById(blankId+i).src = basePath+'/images/blue-star.gif';
    	}
	    document.getElementById(blankId+'Check').value=0;
    }

    var lastId = "aoverview";
    
    function saveWriteReview(frm){

        //frmobj = frm;
        checkingfor = "WriteReview";
        checkSession(frm);
    }
    function resetwriteReview(hidVal,isLogin){
        $("#vTitleReview").val('');
		if(hidVal == 0){
			if(isLogin == 0){
				closeGiveRateDiv("iOverallRate",0);
				closeGiveRateDiv("iAccuracyRate",0);
				closeGiveRateDiv("iValueForMoney",0);
			}
		}
		else if(hidVal == 1){
			if(isLogin == 1){
				closeGiveRateDiv("iOverallRate",1);
				closeGiveRateDiv("iAccuracyRate",1);
				closeGiveRateDiv("iValueForMoney",1);
	
				}	
		}
		
		$("input[type='radio'][name='eRecommend']").val('Yes');
        $("#tReview").val('');
        $("#vAdvantage").val('');
        $("#vDisadvantage").val('');
        $("#vSummary").val('');
    }
    function resetvideoReview(frm,hidVal,isLogin){
		if(hidVal == 1 && isLogin == 1){
			//ClearBrowseContent("vVideoFile");
		}
	}
    function saveVideoReview(frm){
    	//alert('here');
        var vTitleReview = frm.vTitleReview.value;
        var eVideoType = frm.eVideoType.value;
        var vVideoFile = frm.vVideoFile.value;
        var vDescription = frm.vDescription.value;

        //frmobj = frm;
        checkingfor = "VideoReview";
        checkSession(frm);
    }
    function closeGiveRateDiv(imgId,isLogin) {
		if(isLogin == 1){
			$("#"+imgId).val('0');
			for(i=0;i<5;i++)
				document.getElementById(imgId+i).src = basePath+'/images/blue-star.gif';
		}
	}
    function editRecommendValue()
    {
        var imgsrc = basePath+'/images/';
        if(document.getElementById("eRecommendNo").value=='No'){
            document.getElementById("eRecommendNo").value='Yes';
            document.getElementById("ActiveImg").src=imgsrc+'active-up-hand.gif';
            document.getElementById("InactiveImg").src=imgsrc+'in-active-down-hand.gif';
        }else{
            document.getElementById("eRecommendNo").value='No';
            document.getElementById("ActiveImg").src=imgsrc+'in-active-up-hand.gif';
            document.getElementById("InactiveImg").src=imgsrc+'active-down-hand.gif';
        }
    }
    /*function showHideExt(val){
        html ="";
        if(val=='File'){
            html += '<table width="100%" border="0" cellspacing="2" cellpadding="0"><tr><td width="32%">Upload Video :</td><td width="68%"><input type="file" name="vVideoFile" id="vVideoFile" title="Upload Video" size="40" class="input-browse" /></td></tr></table>';
        }else if(val=='URL'){
            html += '<table width="100%" border="0" cellspacing="2" cellpadding="0"><tr><td width="32%">Video URL from the external site :</td><td width="68%"><input name="vVideoFile" id="vVideoFile" title="enter Video URL from the external site" type="text" size="40" /></td></tr></table>';
        }else if(val==''){
            html +="";
        }
        $("#setUploadFormat").html(html);
    }*/
    function showHideExt(val){
        html ="";
        if(val=='URL'){
            //html += '<table width="100%" border="0" cellspacing="2" cellpadding="0"><tr><td width="32%">Video URL from the external site :</td><td width="68%"><input name="vVideoFile" id="vVideoFile" title="enter Video URL from the external site" type="text" size="40" /></td></tr></table>';
            html += '<input name="vVideoFile" id="vVideoFile" title="enter Video URL from the external site" type="text" size="40" class="input"  />';
        }else{
            //html += '<table width="100%" border="0" cellspacing="2" cellpadding="0"><tr><td width="32%">Upload Video :</td><td width="68%"><input type="file" name="vVideoFile" id="vVideoFile" title="Upload Video" size="40" class="input" /></td></tr></table>';
            html += '<input type="file" name="vVideoFile" id="vVideoFile" title="Upload Video" size="40" class="input" />';
        }
        $("#setUploadFormat").html(html);
    }
    function ClearBrowseContent(control)
    {
        var browse=document.getElementById(control);
        var newbrowse= browse.cloneNode(false);
        browse.parentNode.replaceChild(newbrowse ,browse);
    }

    //function setVideoReview(val,extra_param){
    //	if(extra_param==undefined)
    //        extra_param='';
    //    else
    //      extra_param = decode64(extra_param);
    function setVideoReview(val,page){
        $jqv = jQuery.noConflict();
        if(page==undefined) page=1;
		$jqv('#showVideoReview').html('<div style="text-align:center"><img src="'+basePath+'/images/ajax-loader.gif " /></div>');
        //$.post(basePath+"/product/ajax/VideoReview",{"temp":"product","iProductId":val+extra_param},function(data){
        $jqv.post(basePath+"/product/ajax/VideoReview/0/" + page,{"temp":"product","iProductId":val},function(data){
            $jqv("#showVideoReview").html(data);
			//$.hideprogress();
        });
        $ = jQuery.noConflict();
    }

    function setVideoReviewNew(val,page){
        $jqv = jQuery.noConflict();
        if(page==undefined) page=1;
		$jqv('#showVideoReview').html('<div style="text-align:center"><img src="'+basePath+'/images/ajax-loader.gif " /></div>');
        //$.post(basePath+"/product/ajax/VideoReview",{"temp":"product","iProductId":val+extra_param},function(data){
        $jqv.post(basePath+"/product/ajax/VideoReviewNew/0/" + page,{"temp":"product","iProductId":val},function(data){
            $jqv("#showVideoReview").html(data);
			//$.hideprogress();
        });
        $ = jQuery.noConflict();
    }

	//function showVideoReview(val,extra_param){
    function showVideoReview(val,page)
    {
        if(page==undefined) page=1;
		$('#showVideoReview').html('<div style="text-align:center"><img src="'+basePath+'/images/ajax-loader.gif " /></div>');
        $.post(basePath+"/member/profile/VideoReview/0/" + page,{"temp":"member","MemberId":val},function(data){
            $("#showVideoReview").html(data);
        });
    }
	
    function showMemberReview(val,page)
    {
    	//if(extra_param==undefined)
        //    extra_param='';
        //else
        //    extra_param = decode64(extra_param);
        if(page==undefined) page=1;
        //alert(extra_param);
		$('#showVideoReview').html('<div style="text-align:center"><img src="'+basePath+'/images/ajax-loader.gif " /></div>');
        //$.post(basePath+"/member/profile/VideoReview",{"temp":"member","iMemberId":val+extra_param},function(data){
       //$.post(basePath+"/member/profile/VideoReview/0/" + page,{"temp":"member","iMemberId":val},function(data){
		$.post(basePath+"/member/myaccount/reviews/0/" + page,{"temp":"member","iMemberId":val},function(data){
            $("#showVideoReview").html(data);
			////$.hideprogress();
        });
    }


    function openWishBox(iProductId){
    	checkingfor = "openWishBox";
        whatprocess[0] = iProductId;
        checkSession('');
    }
    function saveProductToWishList(ProductId){
    	//alert($("#mywishcombo").val());return false;
        if($("#mywishcombo").val()==''){
            alert("Please select  "+$("#mywishcombo").attr("title"));
            $("#mywishcombo").focus();
            return false;
        }
        $.post(basePath+"/product/ajax/saveProductToWishList/1",{"WishId":$("#mywishcombo").val(), "ProductId":ProductId},function(data){

            if(data != 0){
                msg = 'Product is added to your wish list.';
                tb_remove();
                setTimeout('alert(msg)',2000);
            }else{
                msg = 'Product is Already exits in selected Wish List';
                alert(msg);
            }
        });
    }

    function showBestPrice(productId,categoryId,brandId, iShopId, stoploader){
        var extra_param = "";
		if(extra_param==undefined)
            extra_param='';
        else
            extra_param = decode64(extra_param);
			if(stoploader == "show")
				$('#showbestPrice').html('<div style="text-align:center"><img src="'+basePath+'/images/ajax-loader.gif " /></div>');
        	//$("#showbestPrice").html($.showprogress('Best Price','Searching for the best price...',basePath));
			$.post(basePath+"/product/ajax/bestprice/1",{"iProductId":productId,"iCategoryId":categoryId,"iBrandId":brandId+extra_param,"iShopId":iShopId, "stoploader":stoploader},function(data){
            $("#showbestPrice").html(data);
        });
		
    }
	
	
	function showdivReview(userid){
        
        extra_param = decode64(userid);
		$('#showdivReview').html('<div style="text-align:center"><img src="'+basePath+'/images/ajax-loader.gif " /></div>');
        $.post(basePath+"/member/profile/show/1",{"UserID":userid},function(data){
            $("#showdivReview").html(data);
			//$.hideprogress();
        });
		
    }



    function showOverview(productId,categoryId,brandId){
        $('#showoverview').html('<div style="text-align:center"><img src="'+basePath+'/images/ajax-loader.gif " /></div>');
		$.post(basePath+"/product/ajax/overview/1",{"iProductId":productId,"iCategoryId":categoryId,"iBrandId":brandId},function(data){
            $("#showoverview").html(data);
			//$.hideprogress();
        });
    	
	}

    function showVideoInBox(videourl,type,title){
        var video = encode64(videourl);
        if(type=="file"){
            tb_show(title,"http://www.comparereviews.co.uk/ajax/showvideo/?videourl="+video+"&type="+type+"&height=340&width=550&KeepThis=true&TB_iframe=true", false);
        }else if(type=="url"){
            tb_show(title,"http://www.comparereviews.co.uk/ajax/showvideo/?videourl="+video+"&type="+type+"&height=370&width=470&KeepThis=true&TB_iframe=true", false);
        }
    }

    function playVideo(videoId,videoTitle){
        //var video = encode64(videourl);

        videoTitle = typeof(videoTitle) != 'undefined' ? videoTitle : "Play Video";

        tb_show(videoTitle,basePath + "/member/index/view/" + videoId + "/0/1",false);
        /*
        if(type=="file"){
            tb_show(title,"http://www.comparereviews.co.uk/ajax/showvideo/?videourl="+video+"&type="+type+"&height=340&width=550&KeepThis=true&TB_iframe=true", false);
        }else if(type=="url"){
            tb_show(title,"http://www.comparereviews.co.uk/ajax/showvideo/?videourl="+video+"&type="+type+"&height=370&width=470&KeepThis=true&TB_iframe=true", false);
        }
        */
    }



    function createPriceAlert(iProductId,iPrice){
        whatprocess[0] = iProductId;
        whatprocess[1] = iPrice;

        checkingfor = "createPriceAlert";
        checkSession('');
    }

    function TagTheProduct(){
        checkingfor = "TagTheProduct";
        checkSession('');
    }

    function NomitedCrown(id){
        whatprocess[0] = id;
        checkingfor = "NomitedCrown";
        checkSession('');
    }

    function showMsg(msg){
        $("#var_msg").html(msg);
    }
    

function openwishlist(){
	tb_remove();
	setTimeout("openNewWishList()","1000");
	isOpen=true;
}

function openNewWishList()
{
    call_wait_div();
    $('#hiddenDialogText').html("");
    html = "";
    html += "<table border='0' cellpadding='2' cellspacing='1' width='100%'>";
    html += "<tr><td nowrap='nowrap'><strong>List Name :</strong></td><td><input type='text' alt='*' title='List Name' name='vWishlistTitle' id='vWishlistTitle' size='25' /></td></tr>";
    html += "<tr><td valign='top' nowrap='nowrap'><strong>Description :</strong></td><td><textarea alt='*' title='Description' name='vWishlistDesc' id='vWishlistDesc' cols='30' rows='4'></textarea></td></tr>";
    html += "<tr><td valign='top'>&nbsp;</td><td align='left'><input type='image' src='"+basePath+"/images/btn-submit.gif' class='noinput' onclick='saveWishList()'></td></tr>";
    html += "</table>";
    $('#hiddenDialogText').html(html);
    tb_show("Create New Wish List", "#TB_inline?height=165&width=350&inlineId=hiddenDialogText&modal=true", false);
}

function saveWishList(){
	if($("#vWishlistTitle").val()==''){
    	alert("Please enter "+$("#vWishlistTitle").attr("title"));
        $("#vWishlistTitle").focus();
        return false;
	}else if($("#vWishlistDesc").val()==''){
    	alert("Please enter "+$("#vWishlistDesc").attr("title"));
        $("#vWishlistDesc").focus();
        return false;
	}
	$.post(basePath+"/product/ajax/savewishlist/1",{"WishTitle":$("#vWishlistTitle").val(), "WishDesc":$("#vWishlistDesc").val()},function(data){
    data_arr = data.split(",");
    
    	if(data_arr[0] == 'sucess'){
    		msg = 'Wish list Created Successfully.';
        	isOpen=false;
			tb_remove();                        
                if($("#wishlistcombo").length!=0)
               {var selected=document.getElementById("wishlistcombo").value;
                        
        	$("#wishlistcombo").html(data_arr[1]);

                document.getElementById("wishlistcombo").value=selected;
               }
        	setTimeout('alert(msg)',2000);
        	var combo = document.getElementById("wishlistcombo").cloneNode(true);

			$(combo).attr("name","mywishcombo");
		    $(combo).attr("id","mywishcombo");
		   // $("#wishTd").html($(combo));
        	
     	}
        else if(data_arr == '-1')
        {
            alert('Please Enter Valide Data');
        }
        else {
     		msg = 'Wish list with such name already exits.';
        	alert(msg);
     	}
    });

}

