$(document).ready(function(){$(".slideshow").cycle({fx:"fade",timeout:8000,pause:1,before:b});function b(){$(this).css("cursor","pointer");$(this).click(function(){window.location.href=""+this.name+"";});var h=(this.alt).split("$");var e=h[0];var f=h[1];var g=h[2];var c;if(f==1){c="books";}else{if(f==2){c="dvds";}else{if(f==3){c="games";}else{if(f==4){c="music";}}}}var d="search/"+f+"/"+c+"/currentoffers";$("#output").html("<span style='font-family:arial;font-size:12px;color:#093766'><a href="+this.name+" class='offerlink'>"+h[0]+"</a></span>");$("#offered").html("<span style='font-family:arial;font-size:12px;color:#093766'><a href="+this.name+" class='offerlink'>"+h[2]+"</a></span>");$("#viewMore").html("<br/><span style='font-family:arial;font-size:13px;color:#093766;font-weight:bold'><a href="+d+" class='offerlink'>View More</a></span>");}function a(){if($("#contactForm").is(":hidden")){$("#contactForm").slideDown("slow");$;}else{$("#contactForm").slideUp("slow");}}$(".contact").click(function(){a();});$("a[href*=#]").each(function(){if(location.pathname.replace(/^\//,"")==this.pathname.replace(/^\//,"")&&location.hostname==this.hostname&&this.hash.replace(/#/,"")){var d=$(this.hash),e=$("[name="+this.hash.slice(1)+"]");var c=d.length?d:e.length?e:false;if($(this.hash).length){$(this).click(function(f){var h=$(this.hash).offset().top;var g=this.hash;f.preventDefault();$("html, body").animate({scrollTop:h},500);return false;});}}});});function searchKeywords(a,b){$("#searchTextBox").val(a);$("#searchKeywordsForm").submit();}String.prototype.trim=function(){return this.replace(/^\s*/,"").replace(/\s*$/,"");};function showList(){$("#suggest1").focus().autocomplete(arr);}Array.prototype.unique=function(){var d={},b,a=this.length,c=[];for(b=0;b<a;b++){d[this[b]]=this[b];}for(b in d){c.push(d[b]);}return c;};function indexLessThanThousand(b,a,c){return(a<1000);}function forgotPassword(){$("#Inputsubmit").removeAttr("disabled");var b=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;var a=$("#Inputemail").val();var c=b.test(a);if(c==false){alert("This is not a valid email address.");return false;}else{$("#Inputemail").after("<span id='loadingSpanForEmail'><img src='/images/ajax-loader.gif'></img></span>");$("#Emailmessage").html("Sending email...");$.post("/ajax",{"action":"forgotPassword","email":a},function(e){var d=$(e).find("status").text();$("#loadingSpanForEmail").remove();alert(d);});$("#Emailmessage").html("");}}function addUserItem(){$("#Message").empty();var c=$("#ItemAddCategory").val();var b=$("#ItemAddTitle").val();var e=$("#ItemAddUid").val();var d=$("#ItemAddAuthorText").val();var a=$("#ItemAddEmail").val();$("#Message").html("Thanks for providing us information about your item.");$.post("/ajax",{"action":"ItemAddEmail","email":a,"authtx":d,"cat":c,"titletx":b,"uidtx":e},function(g){var f=$(g).find("status").text();});}function signUpOnSms(){$("#Button").attr("disabled","disabled");$("#erroremail").empty();$("#errorphoneno").empty();$("#userMessage").empty().remove();$("#smsMessage").empty().remove();$("#afterButton").empty().remove();var e=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;var b=/^([9]{1})([02346789]{1})([0-9]{8})$/;var d=$("#inputemail").val();var c=$("#inputphoneno").val();var a=e.test(d);var f=b.test(c);if(a==false){$("#erroremail").html("Please enter a valid email address.").css({color:"orange"}).show();}if(f==false){$("#errorphoneno").html("Please enter a valid 10 digit mobile number here.").css({color:"orange"}).show();}if(a==false||f==false){$("#Button").removeAttr("disabled");return false;}if(a==true&&f==true){$("#Button").attr("disabled","disabled");$("#inputemail").after("<span id='loadingSpanForEmail'><img src='/images/ajax-loader.gif'></img></span>");$("#erroremail").html("Sending email...");$("#inputphoneno").after("<span id='loadingSpanForSms'><img src='/images/ajax-loader.gif'></img></span>");$("#errorphoneno").html("Sending SMS...");$.post("/ajax",{"action":"signUpOnSms","email":d,"phoneno":c},function(h){var g=$(h).find("status").text();if(g=="Exist"){$("#erroremail").html("email already exist, please choose another id.");$("#errorphoneno").html("");$("#Button").after("<div id='userMessage' style='color:orange;font-family:verdana;font-weight:bold;font-size:12px;'>If you are seeing here message like 'email already exist' that means  you have already<br/>registered with us but may be possible you have not yet activated your account.<br/>If this, then go through your mailbox and click the activation link to activate account</div>");$("#loadingSpanForEmail").remove();$("#loadingSpanForSms").remove();$("#Button").removeAttr("disabled");return false;}else{$("#erroremail").html("");$("#errorphoneno").html("");$("#Button").after("<div id='smsMessage' style='color:orange;font-family:verdana;font-weight:bold;font-size:12px;'><br/>We have sent you a SMS containing authorization Code.<br/>Please enter the same below.</div>");var i='<div id=\'afterButton\'><br/><input id=\'userId\' type=\'hidden\' /><input id="authField" type="text" value="enter authorization code" onfocus="$(this).val(\'\')"/>&nbsp;&nbsp;&nbsp;&nbsp;<input id=\'VerifyNow\' type="button" value="Verify Now" onclick="javascript:verifyPhone($(\'#authField\').val());"></div><br/><span id="ErrorVerify"></span><br/>';
$("#smsMessage").after(i);$("#userId").val($(h).find("status").attr("userId"));$("#loadingSpanForEmail").remove();$("#loadingSpanForSms").remove();}});}}function requestForEnvelopes(){$("#requestEnvelops").empty();$("#requestEnvelops").append("<img src='/images/myaccount/requestOver.gif'></img>");$("#requestEnvelops").after("<span id='loadingSpan'><img src='/images/ajax-loader.gif'></img></span>");document.location.href="/suggestions?action=envelopesRequest";}function verifyPhone(b){$("#VerifyNow").attr("disabled","disabled");var a=$("#userId").val();$("#authField").after("<span id='loadingSpan'><img src='/images/ajax-loader.gif'></img></span>");$("#ErrorVerify").html("Verifying Authorization Code...");$.post("/ajax",{"userId":$("#userId").val(),"authCode":b,"action":"verifyAuthCode"},function(g){var f=$(g).find("status").text();var e=$(g).find("status").attr("userId");var d=$(g).find("status").attr("authCode");var c=$(g).find("status").attr("password");if(f=="true"){$("#failVerificationMessage").empty().remove();$("#ErrorVerify").html("");$("#VerifyNow").after("<div id='successVerificationMessage'><br/><span style='color:orange;font-family:verdana;font-weight:bold;font-size:12px;'><img src='/images/homepage/arrow.png' />Congratulations! You have verified your phone number to receive FlipGraph alerts.<br/><img src='/images/homepage/arrow.png' />You have got 20 flips for free! <br/><img src='/images/homepage/arrow.png' />Your password has been sent in SMS as well.</span></div>");$("#loadingSpan").remove();}else{if(f=="false"){$("#successVerificationMessage").empty().remove();$("#ErrorVerify").html("");$("#VerifyNow").after("<div id='failVerificationMessage'><br/><span style='color:orange;font-family:verdana;font-weight:bold;font-size:12px;'>You have entered wrong authorization code.Please try again</span></div>");$("#loadingSpan").remove();$("#VerifyNow").removeAttr("disabled");}}});}function changePassword(){$("#updateButton").attr("disabled","disabled");var b=$("#oldPassword").val();var c=$("#newPassword").val();var a=$("#confirmPassword").val();$.post("/ajax",{"action":"changePassword","old":b,"new":c,"confirm":a},function(d){$("#passwordMessage").html($(d).find("status").text());$("#updateButton").removeAttr("disabled");});}function editProfile(){document.UpdateUserProfile.submit();}function checkEmailAndPhone(){$("#Error").html("");$("#ErrorEmail").remove();$("#InputButton").after("<div id='ErrorEmail'></div>");var e=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;var b=/^([9]{1})([234789]{1})([0-9]{8})$/;var d=$("#InputEmail").val();var c=$("#InputPhoneNo").val();var a=e.test(d);var f=b.test(c);if(a==false){$("#ErrorEmail").remove();alert("Please enter a valid email address.");}if(f==false){$("#ErrorEmail").remove();alert("Please enter a valid 10 digit mobile number here.");}if(a==false&&f==false){return false;}if(a==true&&f==true){$.post("/ajax",{"email":d,"phoneno":c,"action":"whatsComingNext"},function(h){var g=$(h).find("status").text();if(g=="Exist"){$("#ErrorEmail").html("email already exist, please choose another id.");}else{$("#ErrorEmail").html(g);}});}}function lookup(a){$().ajaxStart($.unblockUI);$().ajaxStop($.unblockUI);var b=$("option:selected").val();if(a.length==0){$("#suggestions").hide();}else{$.get("/ajax",{"search":a,"pt":b,"action":"keywords"},function(c){$("#suggestions").show();$("#autoSuggestionsList").empty();$("#autoSuggestionsList").append("<ul>");$(c).find("title").each(function(){var j=decodeURIComponent($(this).text()).replace(/\+/g," ");var h=$(this).attr("id");var f=$(this).attr("class");var e=$(this).attr("src");var g=$(this).attr("source");var i=$(this).attr("uniqueId");var d=$(this).attr("swatch");$("#autoSuggestionsList").append("<li uniqueId='"+i+"' source='"+g+"' src='"+e+"' id='"+h+"' class='"+f+"'><img src='"+d+"'/><span id='"+i+"'>"+j+"</span></li>");});$("#autoSuggestionsList").append("</ul>");if($("#autoSuggestionsList").html().length==0){$("#middleSectionBody").css("z-index","0");$("#suggestions").hide();}$("li").click(function(){var d=$(this).attr("uniqueId");fill($("#"+d).text());});});}}function fill(a){$("#middleSectionBody").css("z-index","0");$("#InputSearch").val(a).select();$("#autoSuggestionsList").empty();$("#suggestions").hide();}function video(a){$("#"+a).youtube({callback:$.youtube.playVideo(a)});}function displaySearchList(a){$().ajaxStart(function(){$.blockUI({border:"none",padding:"15px",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px",opacity:".5",color:"#fff"});});$().ajaxStop($.unblockUI);$.post("/ajax",{"pgid":a,"action":"subList"},function(b){if($(b).find("product").length==0){Boxy.load("itemadd.html",{unloadOnHide:true,modal:true});}else{displayData(a,b);}});}function getTabsData(c){var b=0;var a=c;if(c=="Movies"){a="DVD";}if(c=="Books"){a="BOOK";}if(c=="Music"){a="MUSIC";}if(c=="Games"){a="GAME";}$.post("/ajax",{"req":a,"action":"latest"},function(d){$(d).find("product").each(function(){var h=decodeURIComponent($(this).text()).replace(/\+/g," ");
var g=decodeURIComponent($(this).attr("completeTitle")).replace(/\+/g," ");var e=$(this).attr("mediumImage");var f=$(this).attr("productType");var j=$(this).attr("uniqueId");var i;if(f==1){i="books";}else{if(f==2){i="dvds";}else{if(f==3){i="games";}else{if(f==4){i="music";}}}}$("#"+a+b).html(h).show();$("#"+a+b).attr("href","/product/"+i+"/"+j+"/"+f+"/"+g.replace(/ /g,"-"));$("#"+a+"Url"+b+" img").attr("src",e);$("#"+a+"Url"+b).attr("href","javascript:Boxy.load('/largeimage.html?url="+$(this).attr("largeImage")+"',{unloadOnHide:'true',modal:'true'})");b++;});});}function checkEmail(a){if(a.length==0){$("#ErrorEmail").html("email can't be null").css({color:"red"}).show();return false;}else{$("#InputEmail").after("<span id='loadingSpan'><img src='/images/ajax-loader.gif'></img></span>");$.post("/ajax",{"req":a,"action":"checkLogin"},function(b){ajaxresponse=$(b).find("status").text();if(ajaxresponse=="Exist"){$("#ErrorEmail").html("email already exist, please choose another id.").css({color:"red"}).show();$("#loadingSpan").remove();$("#InputSubmit").attr({disabled:"disabled"});return false;}else{$("#ErrorEmail").html("").css({color:"green"}).show();$("#InputSubmit").removeAttr("disabled");}$("#loadingSpan").remove();});}return true;}function displayAddItemList(c,d){$(".MiddleSearchSectionShowSearchOnButtonClick").empty().remove();$("#Pagination").empty();var b=$("#category").val();var a=$("#TitleText").val();var f=$("#UniqueIdText").val();var e=$("#AuthorText").val();if(typeof a=="undefined"){a="";}if(typeof f=="undefined"){f="";}if(typeof e=="undefined"){e=="";}$().ajaxStart(function(){$.blockUI({border:"none",padding:"15px",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px",opacity:".5",color:"#fff"});});$().ajaxStop($.unblockUI);$.get("/addItem?cat="+b+"&titletx="+a+"&uidtx="+f+"&authtx="+e,function(h){c=$(h).find("product").length;var g=$(h).find("product").text();if(g=="Not Found"){$("#Pagination").hide();Boxy.load("/itemadd.html?titletx="+a+"&uidtx="+f+"&authtx="+e+"&cat="+b,{unloadOnHide:true,modal:true});}else{$("#Pagination").pagination(c,{num_edge_entries:2,num_display_entries:6,items_per_page:d,callback:pageselectCallback});callback:displaySearchList(id);}});}function selectID(){var a=$("#category").val();if(a=="BOOK"){$("#uniqueId").empty().append("ISBN");}if(a=="MOVIE"){$("#uniqueId").empty().append("UPC");}if(a=="GAME"){$("#uniqueId").empty().append("UPC");}if(a=="MUSIC"){$("#uniqueId").empty().append("EAN");}}function selectChar(){var a=$("#category").val();if(a=="BOOK"){$("#uniqueChar").empty().append("Author");}if(a=="DVD"){$("#uniqueChar").empty().append("Director");}if(a=="GAME"){$("#uniqueChar").empty().append("Studio");}if(a=="MUSIC"){$("#uniqueChar").empty().append("Artist");}}function pointsConversion(d){var b=$("#pointSelect").val();var a=parseInt(b);var c=parseInt(d);if(a>c){alert("Sorry! you do not have enough points to convert into flips");}else{$("#pointConvert").empty();$("#pointConvert").append("<img src='/images/convertpointsover.gif'>");document.location.href="/suggestions?action=pointsToFlips&pointsToConvert="+b;}}function tagSubmit(a,b,d,c,e,g){var f=$("#tagTextBox").val();if(f==""){alert("Please Enter Relevant Tags");return false;}else{$.post("/ajax",{"action":d,"pn":a,"pgid":b,"pid":c,"pt":e,"uid":g,"tag":f},function(i){var h=$(i).find("status").text();alert(h);});}}function sendReminder(b,a){$("#reminder"+a).after("<span id='loadingSpan'><img src='/images/ajax-loader.gif'></img></span>");$.post("/ajax",{"action":"sendReminder","emailId":b},function(c){ajaxresponse=$(c).find("status").text();$("#Error").html(ajaxresponse).show();$("#loadingSpan").remove();});}function loadCountries(){$("#country").empty();$.post("/ajax",{"action":"loadCountries"},function(a){$(a).find("country").each(function(){var b=decodeURIComponent($(this).attr("countryCode")).replace(/\+/g," ");$("#country").append('<option value="'+b+'">'+decodeURIComponent($(this).text()).replace(/\+/g," ")+"</option>");});});}function loadCities(b){if(typeof b=="undefined"){b="";}$("#city").empty();var a=$("#country option:selected").val();$.post("/ajax",{"action":"selectDistrict","countryCode":a,"stateName":b},function(c){$(c).find("city").each(function(){if($(this).text()=="Not Found"){}else{$("#city").append('<option value="'+decodeURIComponent($(this).text()).replace(/\+/g," ")+'">'+decodeURIComponent($(this).text()).replace(/\+/g," ")+"</option>");}});$("#city").children(":eq(0)").attr("selected","true");});}function loadStates(){$("#state").empty();$("#city").empty();var a=$("#country option:selected").val();$.post("/ajax",{"action":"selectState","countryCode":a},function(b){$("#state").append("<option>Select State</option>");$(b).find("state").each(function(){if($(this).text()=="Not Found"){$("#state").empty();loadCities("");}else{$("#state").append('<option value="'+decodeURIComponent($(this).attr("stateCode")).replace(/\+/g," ")+'">'+decodeURIComponent($(this).text()).replace(/\+/g," ")+"</option>");
}});});}function loadAreas(){var c=$("#country option:selected").val();var d=$("#state option:selected").html();var b=$("#city option:selected").val();var e=$("#zipCode").val();if(typeof d=="undefined"){d="";}if(typeof b=="undefined"){b="";}if(typeof e=="undefined"){e="";}$("#postalAreas").empty();var a="";document.getElementById("suggestBoxElement").style.visibility="visible";$.post("/ajax",{"action":"postalAreas","postalCode":e,"countryCode":c,"stateName":d,"districtName":b},function(f){$(f).find("area").each(function(){if($(this).text()=="Not Found"){document.getElementById("suggestBoxElement").style.visibility="hidden";}else{a+="<div class='suggestions'>"+decodeURIComponent($(this).text()).replace(/\+/g," ")+"</div>";}});document.getElementById("suggestBoxElement").innerHTML=a;});}function closeSuggestBox(){document.getElementById("suggestBoxElement").innerHTML="";document.getElementById("suggestBoxElement").style.visibility="hidden";}function checkAddressInfo(){$("#ErrorAddressLine2, #ErrorCity, #ErrorState, #ErrorCountry, #ErrorZipCode, #ErrorPhoneNo").empty();var e=$("#addressLine1").val().trim();var d=$("#addressLine2").val().trim();var a=$("#phoneNo").val().trim();var c=$("#zipCode").val().trim();var b;if(e==""&&d==""){$("#ErrorAddressLine2").html("Please fill up your address.");}if(c==""){$("#ErrorZipCode").html("Please fill up Pincode/Zipcode.");}if(isNaN(a)){$("#ErrorPhoneNo").html("Please enter numeric value only");b=false;}else{if(a.length<10){b=false;$("#ErrorPhoneNo").html("Please enter valid phone number");}else{b=true;}}if(c==""||(e==""&&d=="")||b==false){return false;}else{return true;}}function checkOffer(){var a=$("input[name='itid']:checked").val();if(typeof a=="undefined"){alert("Sorry! No offer available for this product now.");return false;}else{$("#loadingSpan").show();$("#offerBuyButton").attr("disabled","disabled");$("#buyForm").submit();}}function requestProduct(a){var b=$(".offerorSelect:checked").val();if(typeof b=="undefined"){alert("Sorry! No offer available for this product now.");return false;}else{$("#loadingSpan").show();$("#"+a).attr("disabled","disabled");$.post("/ajax",{"action":a,"itid":b},function(d){var c=$(d).find("response").text();if(c=="Added"){alert("Your item has been added to your cart.Close this dialog box and click on 'View Cart' button to see your cart items.");}else{if(c=="Not Added"){alert("Some error occurred. Please try after sometime.");}}if(a=="get_it_now"){document.location.href="/cart.html";}});$("#loadingSpan").remove();}}function calculateTotalCost(){var a=$("input[name='checked']:checked").val();if(typeof a=="undefined"){a="null";}var b=$("input[name='itid']:checked").val();$.get("/ajax?action=calculateTotalCost&itid="+b+"&checked="+a,function(c){$("#totalCost").html($(c).find("totalCost").text());});}function updateAddress(){$("#updateAddressButton").hide();$("#updateAddressSubmit").show();$("#updateAddressCancel").show();$("#addressLine1, #addressLine2, #city, #state, #country, #phoneNo, #zipCode, #addressType").removeAttr("disabled");$("#offerBuyButton").attr("disabled","true");var a=$("#addressListSize").val();checkAgreement(a);}function updateCancel(){$("#updateAddressButton").show();$("#updateAddressSubmit").hide();$("#updateAddressCancel").hide();$("#addressLine1, #addressLine2, #city, #state, #country, #phoneNo, #zipCode, #addressType").attr("disabled","true");$("#offerBuyButton").removeAttr("disabled");$("#ErrorAddressLine2, #ErrorCity, #ErrorState, #ErrorCountry, #ErrorZipCode, #ErrorPhoneNo").empty();var a=$("#addressListSize").val();checkAgreement(a);}function submitOfferForm(){var a=$("#condition").val();if(a=="0"){alert("Please select the condition of the product.");}else{$("#loadingSpan").show();$("#offerBuyButton").attr("disabled","disabled");$("#offerForm").submit();}}function loadCountriesForAds(a){$("#countryName").empty();$("#cityName").attr("disabled",true);$("#stateName").attr("disabled",true);$("#countryName").after("<span id='loadingSpanForCountry'><img src='/images/ajax-loader.gif'></img></span>");$.post("/ajax",{"action":"loadCountries"},function(b){$(b).find("country").each(function(){var c=decodeURIComponent($(this).attr("countryCode")).replace(/\+/g," ");var d=decodeURIComponent($(this).text()).replace(/\+/g," ");var e;if(d.length>15){e=d.substr(0,15)+"...";}else{e=d;}if(a==c){$("#countryName").append("<option selected='true' value=\""+c+'" title="'+d+'">'+e+"</option>");loadStatesForAds(a);}else{$("#countryName").append('<option value="'+c+'" title="'+d+'">'+e+"</option>");}$("#loadingSpanForCountry").remove();});});}function loadCitiesForAds(b){if(typeof b=="undefined"){b="";}$("#cityName").empty();$("#cityName").append("<option value='none'>--Select City--</option>");var a=$("#countryName option:selected").val();$("#cityName").after("<span id='loadingSpanForCity'><img src='/images/ajax-loader.gif'></img></span>");$.post("/ajax",{"action":"selectDistrict","countryCode":a,"stateName":b},function(c){$(c).find("city").each(function(){if($(this).text()=="Not Found"){$("#cityName").attr("disabled",true);
$("#loadingSpanForCity").remove();}else{$("#cityName").attr("disabled",false);$("#cityName").append('<option value="'+decodeURIComponent($(this).text()).replace(/\+/g," ")+'">'+decodeURIComponent($(this).text()).replace(/\+/g," ")+"</option>");$("#loadingSpanForCity").remove();}});$("#cityName").children(":eq(0)").attr("selected","true");});}function loadStatesForAds(a){$("#stateName").empty();$("#cityName").empty();$("#stateName").append("<option value='none'>--Select State--</option>");$("#cityName").append("<option value='none'>--Select City--</option>");var a=$("#countryName option:selected").val();$("#stateName").after("<span id='loadingSpanForState'><img src='/images/ajax-loader.gif'></img></span>");$.post("/ajax",{"action":"selectState","countryCode":a},function(b){$(b).find("state").each(function(){if($(this).text()=="Not Found"){$("#stateName").attr("disabled",true);$("#loadingSpanForState").remove();loadCitiesForAds("");}else{$("#stateName").attr("disabled",false);$("#cityName").attr("disabled",true);var c=decodeURIComponent($(this).text()).replace(/\+/g," ");var d;if(c.length>12){d=c.substr(0,15)+"...";}else{d=c;}$("#stateName").append('<option value="'+c+'">'+d+"</option>");$("#loadingSpanForState").remove();}});});}function loadCountriesForAdsPopUp(a){$("#country").empty();$("#city").attr("disabled",true);$("#state").attr("disabled",true);$("#country").after("<span id='loadingSpanForCountry'><img src='/images/ajax-loader.gif'></img></span>");$.post("/ajax",{"action":"loadCountries"},function(b){$(b).find("country").each(function(){var c=decodeURIComponent($(this).attr("countryCode")).replace(/\+/g," ");var d=decodeURIComponent($(this).text()).replace(/\+/g," ");var e;if(d.length>15){e=d.substr(0,15)+"...";}else{e=d;}if(a==c){$("#country").append("<option selected='true' value=\""+c+'">'+e+"</option>");loadStatesForAdsPopUp(a);}else{$("#country").append('<option value="'+c+'">'+e+"</option>");}$("#loadingSpanForCountry").remove();});});}function loadCitiesForAdsPopUp(b){if(typeof b=="undefined"){b="";}$("#city").empty();$("#city").append("<option value='none'>--Select City--</option>");var a=$("#country option:selected").val();$("#city").after("<span id='loadingSpanForCity'><img src='/images/ajax-loader.gif'></img></span>");$.post("/ajax",{"action":"selectDistrict","countryCode":a,"stateName":b},function(c){$(c).find("city").each(function(){if($(this).text()=="Not Found"){$("#city").attr("disabled",true);$("#loadingSpanForCity").remove();}else{$("#city").attr("disabled",false);$("#city").append('<option value="'+decodeURIComponent($(this).text()).replace(/\+/g," ")+'">'+decodeURIComponent($(this).text()).replace(/\+/g," ")+"</option>");$("#loadingSpanForCity").remove();}});$("#city").children(":eq(0)").attr("selected","true");});}function loadStatesForAdsPopUp(a){$("#state").empty();$("#city").empty();$("#state").append("<option value='none'>--Select State--</option>");$("#city").append("<option value='none'>--Select City--</option>");var a=$("#country option:selected").val();$("#state").after("<span id='loadingSpanForState'><img src='/images/ajax-loader.gif'></img></span>");$.post("/ajax",{"action":"selectState","countryCode":a},function(b){$(b).find("state").each(function(){if($(this).text()=="Not Found"){$("#loadingSpanForState").remove();$("#state").attr("disabled",true);loadCitiesForAdsPopUp("");}else{$("#state").attr("disabled",false);$("#city").attr("disabled",true);var c=decodeURIComponent($(this).text()).replace(/\+/g," ");var d;if(c.length>12){d=c.substr(0,12)+"...";}else{d=c;}$("#state").append('<option value="'+c+'">'+d+"</option>");$("#loadingSpanForState").remove();}});});}function checkAgreement(a){if(a=="0"){$("#offerBuyButton").attr("disabled","disabled");}else{if(document.getElementById("policyCheck").checked==true){$("#offerBuyButton").removeAttr("disabled");}else{$("#offerBuyButton").attr("disabled","disabled");}}}function displayFilterData(){var c=$("#suggest1").val();c=c.replace(/\+/," ");var b=$("#filterAction").val();var a=$("#filterBy").val();$(".MiddleSearchSectionShowSearchOnButtonClick").empty().remove();$().ajaxStart(function(){$.blockUI({border:"none",padding:"15px",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px",opacity:".5",color:"#fff"});});$().ajaxStop($.unblockUI);$.post("/ajax",{"filteredText":c,"action":b,"filterBy":a},function(d){displayData(0,d);});}function displayData(a,c){var b=0;$(c).find("product").each(function(){var w=$(this).attr("minFlips");var q=$(this).attr("currencyConversionForOld");var u=parseInt(w)*parseInt(q);var C=$(this).attr("free_shipping_old");var k=$(this).attr("shippingCharges_old");var r=$(this).attr("free_shipping_new");var E=$(this).attr("shippingCharges_new");var A=decodeURIComponent($(this).attr("completeTitle")).replace(/\+/g," ");var G=decodeURIComponent($(this).text()).replace(/\+/g," ");var z=decodeURIComponent($(this).attr("metaDescription")).replace(/\+/g," ");var n=$(this).attr("uniqueId");
var p=$(this).attr("productType");var D=$(this).attr("tinyImage");if(D=="null"){D="/images/imagenotavail.gif";}var m=$(this).attr("largeImage");var v=$(this).attr("id");var y=$(this).attr("youtubeVideoId");var s=decodeURIComponent($(this).attr("attribute")).replace(/\+/g," ");var o=decodeURIComponent($(this).attr("original_price")).replace(/\+/g," ");var g=decodeURIComponent($(this).attr("flipgraph_price")).replace(/\+/g," ");var d=$(this).attr("discount");if(s.length>20){s=s.substring(0,20)+"...";}var h=$(this).attr("offerCopiesCount");var j=$(this).attr("newProductCount");var t=$(this).attr("best_seller");var B=$(this).attr("latest_release");var f=$(this).attr("countryCode");var l;var F;if(C=="yes"){l="Free Shipping";}else{l=k;if(f=="GB"){l=l+".00 GBP";}else{l=l+".00 INR";}}if(r=="yes"){F="Free Shipping";}else{F=E;if(f=="GB"){F=F+".00 GBP";}else{F=F+".00 INR";}}var e;var i;if(p==1){e="books";i="books";}else{if(p==2){e="dvds";i="DVD";}else{if(p==3){e="games";i="videogames";}else{if(p==4){e="music";i="music";}}}}var x="http://www.amazon.com/gp/search?keywords="+n+"&index="+i+"&linkCode=qs&tag=flip09-20";$(".MiddleSearchSectionShow").show();$("#InputSearch").removeClass("SearchTextCss");$("#YoutubeLink").attr("href","javascript:Boxy.load('/video.html?pid="+v+"&pt="+p+"',{unloadOnHide:true,modal:true});");if(w=="-1"){$("#minFlips").html("Not Available In Flips&nbsp;");$("#minUsedPrice").html("Not Available In INR.");$("#getButton").html("<img src=/images/get_small_b.gif>");$("#getCurrencyButton").html("<img src=/images/get_small_b.gif>");}else{$("#minFlips").html("In <span style=font-size:14px;font-weight:bold;color:#aa0000>"+w+" Flips.</span>&nbsp;");if(f=="GB"){$("#minUsedPrice").html("In <span style=font-size:14px;font-weight:bold;color:#aa0000>"+u+".00 GBP</span>&nbsp;");}else{$("#minUsedPrice").html("In <span style=font-size:14px;font-weight:bold;color:#aa0000>"+u+".00 INR</span>&nbsp;");}$("#shipping").html("Shipping:<span style=font-size:14px;font-weight:bold;color:#aa0000>"+l+"</span>");if($("#userNickName").text()==""){$("#getButton").html('<a href=javascript:Boxy.load("/LoginPopUP.jsp?action=addReview&pid='+v+"&pt="+p+"&pn=Search&uid="+n+'",{unloadOnHide:true,modal:true});><img src=/images/get_small_g.gif border=0 onmouseover=javascript:$(this).attr("src","/images/login_small_g.gif"); onmouseout=javascript:$(this).attr("src","/images/get_small_g.gif");></a>');$("#getCurrencyButton").html('<a href=javascript:Boxy.load("/LoginPopUP.jsp?action=addReview&pid='+v+"&pt="+p+"&pn=Search&uid="+n+'",{unloadOnHide:true,modal:true});><img src=/images/get_small_g.gif border=0 onmouseover=javascript:$(this).attr("src","/images/login_small_g.gif"); onmouseout=javascript:$(this).attr("src","/images/get_small_g.gif");></a>');}else{$("#getButton").html('<a href=javascript:Boxy.load("/requestpopup/'+v+"/"+p+"/"+A.trim().replace(/ /g,"-")+"/flip"+'",{unloadOnHide:true,modal:true});><img src=/images/get_small_g.gif border=0></a>');$("#getCurrencyButton").html('<a href=javascript:Boxy.load("/requestpopup/'+v+"/"+p+"/"+A.trim().replace(/ /g,"-")+"/currency"+'",{unloadOnHide:true,modal:true});><img src=/images/get_small_g.gif border=0></a>');}}if((o!="0.0"&&g!="0.0")){if(f=="GB"){o=o+"0 GBP";g=g+".00 GBP";}else{o=o+"0 INR";g=+g+".00 INR";}$("#originalprice").html("Original Price:&nbsp;&nbsp;<del><span>"+o+"</span></del>");$("#discount").html("Discount:&nbsp;&nbsp;<span style=font-size:14px;font-weight:bold;color:#aa0000>"+d+"%</span> off ");$("#flipgraphprice").html("FlipGraph Price:&nbsp;&nbsp;<span style=font-size:14px;font-weight:bold;color:#aa0000>"+g+"</span>");if($("#userNickName").text()==""){$("#buyButton").html('<a href=javascript:Boxy.load("/LoginPopUP.jsp?action=addReview&pid='+v+"&pt="+p+"&pn=Search&uid="+n+'",{unloadOnHide:true,modal:true});><img src=/images/addtocart_small_g.gif border=0 onmouseover=javascript:$(this).attr("src","/images/login_small_g.gif"); onmouseout=javascript:$(this).attr("src","/images/addtocart_small_g.gif");></a><br/><br/><br/><a href=javascript:Boxy.load("/LoginPopUP.jsp?action=addReview&pid='+v+"&pt="+p+"&pn=Search&uid="+n+'",{unloadOnHide:true,modal:true});><img src=/images/buy_small_g.gif border=0 onmouseover=javascript:$(this).attr("src","/images/login_small_g.gif"); onmouseout=javascript:$(this).attr("src","/images/buy_small_g.gif");></a>');}else{$("#buyButton").html("<span><form method='post' action='/cart'>"+"<input type='hidden' name='action' value='add_to_cart'>"+"<input type='hidden' name='pid' value='"+v+"'>"+"<input type='hidden' name='pt' value='"+p+"'>"+"<input type='hidden' name='item_type' value='new'>"+"<input type='image' src='/images/addtocart_small_g.gif' border='0'>"+"</form></span><br/>"+"<span><form method='post' action='/cart'>"+"<input type='hidden' name='action' value='get_it_now'>"+"<input type='hidden' name='pid' value='"+v+"'>"+"<input type='hidden' name='pt' value='"+p+"'>"+"<input type='hidden' name='item_type' value='new'>"+"<input type='image' src='/images/buy_small_g.gif' border='0'>"+"</form></span>");
}$("#shippingNew").html("Shipping:<span style=font-size:14px;font-weight:bold;color:#aa0000>"+F+"</span>");}else{$("#originalprice").html("New Copy Not Available");$("#discount").html("");$("#flipgraphprice").html("");$("#buyButton").html("<img src=/images/addtocart_small_b.gif border=0>&nbsp;<img src=/images/buy_small_b.gif border=0>");$("#shippingNew").html("");}if($("#userNickName").text()==""){$("#offerButton").html('<a href=javascript:Boxy.load("/LoginPopUP.jsp?action=addReview&pid='+v+"&pt="+p+"&pn=Search&uid="+n+'",{unloadOnHide:true,modal:true});><img src=/images/offer_small_g.gif border=0 onmouseover=javascript:$(this).attr("src","/images/login_small_g.gif"); onmouseout=javascript:$(this).attr("src","/images/offer_small_g.gif");></a>');$("#offerCurrencyButton").html('<a href=javascript:Boxy.load("/LoginPopUP.jsp?action=addReview&pid='+v+"&pt="+p+"&pn=Search&uid="+n+'",{unloadOnHide:true,modal:true});><img src=/images/offer_small_g.gif border=0 onmouseover=javascript:$(this).attr("src","/images/login_small_g.gif"); onmouseout=javascript:$(this).attr("src","/images/offer_small_g.gif");></a>');}else{$("#offerButton").html('<a href=javascript:Boxy.load("/offerpopup/'+v+"/"+p+"/"+A.trim().replace(/ /g,"-")+"/flip"+'",{unloadOnHide:true,modal:true});><img src=/images/offer_small_g.gif border=0></a>');$("#offerCurrencyButton").html('<a href=javascript:Boxy.load("/offerpopup/'+v+"/"+p+"/"+A.trim().replace(/ /g,"-")+"/currency"+'",{unloadOnHide:true,modal:true});><img src=/images/offer_small_g.gif border=0></a>');}if(h=="0"){$("#offerCopiesCount").hide();}else{if(h=="1"){$("#offerCopiesCount").html("("+h+" Copy Available)");}else{$("#offerCopiesCount").html("("+h+" Copies Available)");}}if(j=="0"){$("#newCopiesCount").hide();}else{if(j=="1"){$("#newCopiesCount").html("("+j+" Copy Available)");}else{$("#newCopiesCount").html("("+j+" Copies Available)");}}if(t=="1"&&B=="1"){$("#plus,#bestSeller,#latestRelease").show();}else{if(t=="1"&&B=="0"){$("#bestSeller").show();$("#plus,#latestRelease").hide();}else{if(t=="0"&&B=="1"){$("#latestRelease").show();$("#plus,#bestSeller").hide();}else{$("#plus,#bestSeller,#latestRelease").hide();}}}$("#ProductImage").attr("href","/product/"+e+"/"+n+"/"+p+"/"+A.replace(/ /g,"-"));$("#ProductImage img").attr("src",D);$("#ProductImage img").attr("title",z);$("#Title0").html(G);$("#Title0").attr("href","/product/"+e+"/"+n+"/"+p+"/"+A.replace(/ /g,"-"));$("#Description0").html(s);$("#Description0").attr("href","#");$("#amazonButton a").attr("href",x);$("#Buy a").attr("href","/buy/"+v+"/"+p+"/"+A.replace(/ /g,"-"));$("#Offer a").attr("href","/offer/"+v+"/"+p+"/"+A.replace(/ /g,"-"));$("#wishList a").attr("href","javascript:Boxy.load('/wishlist.html?action=addToWishList&pn=ProductDetails&pid="+v+"&pt="+p+"',{unloadOnHide:'true',modal:'true'});");$("#addTag a").attr("href","javascript:Boxy.load('/addtag.html?pid="+v+"&pt="+p+"&action1=addTag&pn=Search&pgid="+a+"',{unloadOnHide:'true',modal:'true'});");$(".MiddleSearchSectionShow").clone().attr("class","MiddleSearchSectionShowSearchOnButtonClick").appendTo(".MiddleSearchSection").show();$(".MiddleSearchSectionShowSearchOnButtonClick #usedTable").attr("id","usedTable"+b);$(".MiddleSearchSectionShowSearchOnButtonClick #newTable").attr("id","newTable"+b).hide();$(".MiddleSearchSectionShowSearchOnButtonClick #ownTable").attr("id","ownTable"+b).hide();$(".MiddleSearchSectionShowSearchOnButtonClick #used").attr({id:"used"+b,href:"javascript:showAndHide('usedTable"+b+"','newTable"+b+"','ownTable"+b+"');"});$(".MiddleSearchSectionShowSearchOnButtonClick #new").attr({id:"new"+b,href:"javascript:showAndHide('newTable"+b+"','usedTable"+b+"','ownTable"+b+"');"});$(".MiddleSearchSectionShowSearchOnButtonClick #own").attr({id:"own"+b,href:"javascript:showAndHide('ownTable"+b+"','usedTable"+b+"','newTable"+b+"');"});$("#YoutubeLink").show();$("#minFlips").show();$(".MiddleSearchSectionShow").hide();b++;if(b==20){return false;}});}function showOtherTab(){document.getElementById("oo").style.display="block";}function hideOtherTab(){document.getElementById("oo").style.display="none";}function showAndHide(e,d,c,b){document.getElementById(d).style.display="none";document.getElementById(c).style.display="none";document.getElementById(e).style.display="block";var a=e;a=a.split("Table");a=a[0]+a[1];var g=d;g=g.split("Table");g=g[0]+g[1];var f=c;f=f.split("Table");f=f[0]+f[1];document.getElementById(a).style.backgroundColor="#50A029";document.getElementById(g).style.backgroundColor="#A0DF82";document.getElementById(f).style.backgroundColor="#A0DF82";}function checkOfferRadio(){setTimeout("waitProcess()",250);clearTimeout(0);}function waitProcess(){$("input[@id=offerorSelect1]").attr("checked","true");}function keyPressedForUserLoginPopUp(b){var a=b||window.event;if(a.keyCode=="13"){setTimeout("userLoginForPopUp()",100);clearTimeout(0);}}function userLoginForPopUpVerifier(){var c=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;var b=$("#email_p").val();
var a=$("#password_p").val();if(!c.test(b)){$("#email-missing_p").show();return false;}else{$("#email-missing_p").hide();}if(b==""){$("#email-missing_p").show();return false;}else{$("#email-missing_p").hide();}if(a==""){$("#password-missing_p").show();return false;}else{$("#password-missing_p").hide();}return true;}function userLoginForPopUp(){var a=userLoginForPopUpVerifier();if(a==true){document.lform.action="/login";document.lform.submit();}}