/* Effects for Diggypod */ $(document).ready(function(){ /* ************************************ */ /* Left nav scripts */ /* ************************************ */ // BIND li click to child a $('.ask_order').click(function(){ var x = prompt("Enter Search String: "); if( x == '' ){ return false; } var addy = "/admin/search-results.html?searchAction=search&query=" + x; window.open(addy,"Search Results"); return; }); $('.leftnav ul li').each(function(){ var cur_url = $(this).children('a').attr("href"); if( cur_url != '' ){ $(this).click(function(){ window.location = cur_url; }); } }); /* (First Hover) */ $('.first_left ul li').bind("mouseenter",function(){ // mouse enter background $(this).css('background','url("/images/li-first-bkg-over.png")').css('background-position','3px 0').css('background-repeat','no-repeat'); }).bind("mouseleave",function(){ $(this).css("background","url('/images/li-first-bkg.png')").css('background-position','3px 0').css('background-repeat','no-repeat'); }); /* (Second and Third Hover) */ $('.second_left ul li, .third_left ul li').bind("mouseenter",function(){ // mouse enter background $(this).children('a').css('text-decoration','underline'); }).bind("mouseleave",function(){ $(this).children('a').css('text-decoration','none'); }); /* ( Force Left Nav BKG to full size ) */ var startpoint, stoppoint; startpoint = $('.first_left').offset().top; stoppoint = $('#footer-bkg').offset().top; var lnavheight = ( stoppoint - startpoint ) + 36; $('.leftnav').css('min-height',lnavheight).css('height','auto'); /* TOP Nav Script for Hover */ $('.top-nav-links li a').bind("mouseenter",function(){ $(this).parent('li').css('background','url("/images/li-first-bkg-over.png")').css('background-repeat','repeat'); }).bind("mouseleave",function(){ $(this).parent('li').css('background','none'); }); /* ********************************* */ /* [ PAGE SCRIPTS ] */ /* ******************************/ // printcenter create account buttons $('.newacct').click(function(){ window.location="/printcenter/create-account.html"; }); $('.radios').click(function(){ curid = $(this).attr("id"); if(curid == 'full-color'){ if( $('#color-pages').attr("class") == 'radios radiosO' ){ $('#color-pages').attr("class","radios"); } } if(curid == 'color-pages'){ if( $('#full-color').attr("class") == 'radios radiosO' ){ $('#full-color').attr("class","radios"); } } $(this).toggleClass("radiosO"); }); $('#size5').bind("click",function(){ // update the clicked items class $(this).removeClass('size5_bkg'); $(this).addClass('size5_bkgR'); //remove the non-clicked red classes $('#size6').removeClass('size6_bkgR'); $('#size6').addClass('size6_bkg'); $('#size8').removeClass('size8_bkgR'); $('#size8').addClass('size8_bkg'); $('#book_width').attr("value","5.5"); $('#book_height').attr("value","8.5"); $('#book_size_selection').attr('value','1'); }); $('#size6').bind("click",function(){ // update the clicked items class $(this).removeClass('size6_bkg'); $(this).addClass('size6_bkgR'); //remove the non-clicked red classes $('#size5').removeClass('size5_bkgR'); $('#size5').addClass('size5_bkg'); $('#size8').removeClass('size8_bkgR'); $('#size8').addClass('size8_bkg'); $('#book_width').attr("value","6"); $('#book_height').attr("value","9"); $('#book_size_selection').attr('value','2'); }); $('#size8').bind("click",function(){ // update the clicked items class $(this).removeClass('size8_bkg'); $(this).addClass('size8_bkgR'); //remove the non-clicked red classes $('#size6').removeClass('size6_bkgR'); $('#size6').addClass('size6_bkg'); $('#size5').removeClass('size5_bkgR'); $('#size5').addClass('size5_bkg'); $('#book_width').attr("value","8.5"); $('#book_height').attr("value","11"); $('#book_size_selection').attr('value','3'); }); $('#details5').click(function(){ window.location="/book-printing-5-5x8-5.html"; }); $('#details6').click(function(){ window.location="/book-printing-6x9.html"; }); $('#details8').click(function(){ window.location="/book-printing-8-5x11.html"; }); /* on full load calculate the begning totals */ $('.calculate').click(function(){ calculate_total(); }); $('.newact').click(function(){ var newloc = "/printcenter/create-account.html"; window.location = newloc; }); $('.release').remove(); if( $('.digiknow').index() > 0 ){ move_dyk(); } $('.sub_nav ul li').click(function(){ var thisclick = $(this).children('a').attr('href'); window.location = thisclick; }); $('.sub_nav ul li').bind("mouseenter",function(){ // mouse enter background $(this).css('background','url("/images/sub_nav_bkg-on.png")').css('background-position','top center').css('background-repeat','no-repeat'); }).bind("mouseleave",function(){ $(this).css("background","url('/images/sub_nav_bkg.png')").css('background-position','top center').css('background-repeat','no-repeat'); }); // move compare prices up add asterisk and disclaimer $('.comparePriceMath, .comparePriceText').css('margin-top','-10px'); var price_now = $('.comparePriceMath').children('div:eq(3)').html(); price_now = "**" + price_now; $('.comparePriceMath').children('div:eq(3)').html(price_now); var all_text = $('.comparePriceMath').parent('div').html(); all_text = all_text + "**Example price comparison as of November 15, 2011. Prices may change without notice. Minor printing specifications may vary depending on the order."; $('.comparePriceMath').parent('div').html(all_text); // Turn the Yes in the compare table to images $('.compareTable table tr').children('td').each(function(){ var cur_html = $(this).html(); if( $(this).html() == 'Yes' ){ $(this).html(""); } else if( $(this).html() == 'No' ){ $(this).html(""); } }); }); function move_dyk(){ // Reposition Didgiknow // grab the offset of .digiknow and the index var digiknow = $('.digiknow').index('.page'); var dk_height = $('.digiknow').height(); var dk_pos = $('.digiknow').position(); var dp_height = $('.digiknow').parent('div').height(); var dp_pos = $('.digiknow').parent('div').position(); var dp_start = $('#footer-bkg').position().top; var dp_end = $('.digiknow').position().top; var dp_o = dp_start - dp_end - dk_height - 24; var cur_mt = $('.digiknow').css('margin-top').replace("px",""); cur_mt = cur_mt; if( (dp_o / 4) > 50 ){ $('.digiknow').css('margin-top', ( dp_o/4 )); } // parent height = 901 and the dyk is offset top is 751 and height is 130 so 881 of the 901 and needs 19px top // alert(dp_height + " " + dp_pos.top); // alert(dk_height + " " + dk_pos.top); // we have the height, and the space above and below so we can // var dk_offset = ( (dk_below.top - dk_above.top) / 2 ) - ( ( dk_height ) / 2 ); // $('.digiknow').css('margin-top',(dk_offset)); return; }