current_video = ""; function VeriSign() { dn="SECURE.SEXTOYS.COM"; lang="en"; aff="VeriSignCACenter"; tpt="opaque"; vrsn_style="WW"; splash_url="https://seal.verisign.com"; seal_url="https://seal.verisign.com"; u1=splash_url+"/splash?form_file=fdf/splash.fdf&dn="+dn+"&lang="+lang; u2=seal_url+"/getseal?at=0&&sealid=2&dn="+dn+"&aff="+aff+"&lang="+lang; tbar = "location=yes,status=yes,resizable=yes,scrollbars=yes,width=560,height=500"; sw = window.open(u1,"VRSN_Splash",tbar); sw.focus(); } function toggle_categories(container_div) { if (container_div.style.display == "block") { document.getElementById('categories_toggle').innerHTML = '+ Show Categories'; document.getElementById('categories_container').style.display = 'none'; return false; } else { document.getElementById('categories_toggle').innerHTML = '- Hide Categories'; document.getElementById('categories_container').style.display = 'block'; return false; } } function auto_position() { if (current_video) { if (document.getElementById(current_video)) { document.getElementById(current_video).style.marginTop = document.documentElement.scrollTop + 'px'; } } } function closeplayer() { document.getElementById(current_video).style.display = "none"; } function contacts_list() { if (document.contact_form.contact_type.value == "Billing Questions" || document.contact_form.contact_type.value == "Question about my Order" || document.contact_form.contact_type.value == "Returns") { document.getElementById("titleComments").style.display = "block"; document.getElementById("definitionComments").style.display = "block"; } else { document.getElementById("titleComments").style.display = "none"; document.getElementById("definitionComments").style.display = "none"; } } function starsChange(myVal, startString) { if (startString) { var myStars = new Array(document.getElementById(startString + '1'), document.getElementById(startString + '2'), document.getElementById(startString + '3'), document.getElementById(startString + '4'), document.getElementById(startString + '5')); for (i=0; i < myVal; i++) { if (myVal - i == 0.5) { if (myStars[i] != null) myStars[i].src = 'http://www.sextoys.com/images/star_rate_orange_half.png'; } else { if (myStars[i] != null) myStars[i].src = 'http://www.sextoys.com/images/star_rate_orange.png'; } } var myLeftOvers = 5 - myVal; if (myLeftOvers > 0) { for (i=0; i < myLeftOvers; i++) { if (myStars[eval(myVal + i)]) myStars[eval(myVal + i)].src = 'http://www.sextoys.com/images/star_rate_grey.png'; } } if (window.StarsTimeoutObj) clearTimeout(window.StarsTimeoutObj); if (!window.StarsTimeout && !window.StarsMouseOver) { window.StarsTimeout = 1; window.StarsTimeoutObj = setTimeout("starsChange(" + myVal + ")", 100); } } } function starsRestore(theOriginalValue, startString) { window.StarsTimeout = 0; starsChange(theOriginalValue, startString); } function starsSet(myVal, startString) { document.getElementById('ratingValue').value = myVal; starsChange(myVal, startString); } function showCommentTools(idValue,locationValue,returnType,theStars,theName,theTitle,theComments) { if (!theName) theName = ""; if (!theTitle) theTitle = ""; if (!theComments) theComments = ""; if (!theStars) theStars = 0; myInnerString = '
'; var myCommentTools = document.getElementById('commentTools'); var myDate = new Date(); var mill = myDate.getTime(); if (myCommentTools.innerHTML != "") { myCommentTools.style.display = "block"; document.getElementById("ratingValue").value = theStars; starsRestore(theStars, "myStars"); } else { RequestThreadedDynamicDataFromMySQL("http://www.sextoys.com/review_write.php?noCache=" + mill + "&pnum=" + idValue + "&loc=" + locationValue + "&ret=" + returnType + "&stars=" + theStars + "&name=" + theName + "&title=" + theTitle + "&comments=" + theComments, ProcessPageUpdateJustTheElement, 'commentTools'); setTimeout("starsRestore(document.getElementById('ratingValue').value, 'myStars')", 500); } } function reviewsSubmit(theId, theLoc, theRet, secureCode) { if (document.getElementById("commentArea").value != "") { if (escape(document.getElementById("ratingValue").value) < 1) { alert("You must enter a rating to leave a review."); } else { document.getElementById('saveButton').disabled = true; document.getElementById('saveButton').innerHTML = 'Please Wait...'; newComment(theId, theLoc, theRet, secureCode); $('#review-thanks').show(); } } else { alert("You must enter a comment in order to leave a review."); } } function newComment(idValue,locationValue,returnType, secureCode) { var myDate = new Date(); var mill = myDate.getTime();; myName=escape(document.getElementById("reviewerName").value); myLocation=escape(document.getElementById("reviewerLocation").value); myReviewTitle=document.getElementById("reviewTitle").value myReviewTitle = myReviewTitle.replace(/'/g, "***single-quote***"); myReviewTitle = myReviewTitle.replace(/"/g, "***double-quote***"); myReviewTitle = myReviewTitle.replace(/\r|\n|\r\n/g, "***new-line***"); myReviewTitle = escape(myReviewTitle) myEditTextValue=document.getElementById("commentArea").value myEditTextValue = myEditTextValue.replace(/'/g, "***single-quote***"); myEditTextValue = myEditTextValue.replace(/"/g, "***double-quote***"); myEditTextValue = myEditTextValue.replace(/\r|\n|\r\n/g, "***new-line***"); myEditTextValue = escape(myEditTextValue) myRatingValue=escape(document.getElementById("ratingValue").value); myURL="http://www.sextoys.com/new_review.php?noCache=" + mill + "&action=saveComment&id=" + idValue + "&location=" + locationValue + "&returnType=" + returnType + "&rating=" + myRatingValue + "&review=" + myEditTextValue + "&myLocation=" + myLocation + "&myName=" + myName + "&reviewTitle=" + myReviewTitle + "&captcha_code=" + secureCode; $.post(myURL, function(data){ document.getElementById('reviewsDiv').innerHTML = data; }); //RequestThreadedDynamicDataFromMySQL(myURL, ProcessPageUpdateJustTheElement, 'reviewsDiv'); document.getElementById('reviewerName').value = myName; document.getElementById('reviewerLocation').value = myLocation; } function compareProducts(productNumber) { var myDate = new Date(); var mill = myDate.getTime(); var action = ""; productNumber=escape(productNumber); if(document.getElementById("check_"+productNumber).checked) { action = "add"; } else { action = "sub"; } myURL="http://www.sextoys.com/compare_session_manager.php?noCache=" + mill + "&action=" + action + "&productNumber=" + productNumber; RequestThreadedDynamicDataFromMySQL(myURL,'doNothing',''); } function ProcessPageUpdateJustTheElement(myHTMLString,myElementToUpdate) { document.getElementById(myElementToUpdate).innerHTML=myHTMLString; } function doNothing() {} function RequestThreadedDynamicDataFromMySQL(url, myBlank, target) { if (window.XMLHttpRequest) { req = new XMLHttpRequest(); req.onreadystatechange = function() { if (req.readyState == 4) { if (document.getElementById(target)) { if (req.status == 200) { document.getElementById(target).innerHTML = req.responseText; } else { document.getElementById(target).innerHTML = "Error: " + req.statusText; } } } }; req.open("GET", url, true); req.send(null); } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { if (document.getElementById(target)) { if (req.status == 200) { document.getElementById(target).innerHTML = req.responseText; } else { document.getElementById(target).innerHTML = "Error: " + req.statusText; } } } }; req.open("GET", url, true); req.send(); } } } // these are the functions for highlighting products that are going to be compaired function highlight(id){ var check_box = 'check_'+id; var current_state = document.getElementById(check_box).checked; var rand = Math.random(); if(current_state == true){ document.getElementById(id).style.background='#fff url(/images/check_highlight_ani.gif?id='+rand+') top right no-repeat'; }else{ document.getElementById(id).style.backgroundImage=''; } } function highlight_session(){ } function image_change(imageElement, newImageUrl) { if (document.getElementById(imageElement)) { document.getElementById(imageElement).src = newImageUrl; } } function getFlashMovieObject(movieName) { if (window.document[movieName]) { return window.document[movieName]; } if (navigator.appName.indexOf("Microsoft Internet")==-1) { if (document.embeds && document.embeds[movieName]) return document.embeds[movieName]; } else // if (navigator.appName.indexOf("Microsoft Internet")!=-1) { return document.getElementById(movieName); } } function fill_object(obj_id, hide) { if (hide == "1") { var url = "/player.swf?id=" + obj_id + "&autoplay=true"; var d=document; (d.all)? d.all("vid_" + obj_id).movie = url : d.embeds["vid2_"+ obj_id].src = url; } else { var url = "/player.swf?id=" + obj_id; var d=document; (d.all)? d.all("vid_" + obj_id).movie = url : d.embeds["vid2_"+ obj_id].src = url; } }