//+++++ - After document has loaded - ++++//jQuery(document).ready(function($) {    //+++++ - Function to initialize effects - ++++//    initEffects();    //+++++ - Function for starting the slideshow on the homepage - ++++//    startSliding("#but a",5000); // takes list of items to slide and persistance time in milliseconds (for how long the slide will be displayed)    //+++++ - Function to control the navigation for the slideshow buttons - ++++//    controlButtons("#but a"); // takes as input a list of items    //+++++ - Function to add rounded corners - ++++//    /* replaced with jquery ui css framework    function addRoundedCorners() {        $("#footer").corner("bl 12px").corner("br 12px");        $("#topContent").corner("tl 12px");        $("#updates").corner("bl 12px");        $("#rounded").corner("br 12px").corner("tr 12px");        $(".roundit").corner("12px");        $(".roundit2").corner("12px");    } */    //+++++ - Function to hide slides - ++++//    function hideSlides() {        $('#rounded div .featured_text, #rounded div .featured_image').hide();    }    function initEffects() {        hideSlides(); //make sure all slides are hidden at the beginning        // replaced with jquery ui css framework        //addRoundedCorners();        //Cufon.replace('#peel h1,#updates h1,#welcome h1,.bblue-head', { fontFamily: 'TitilliumText14L' });        firstSlide(1); //pick which slide is showed first; 1 through 5 (1-5); replace as needed        $("ul.sf-menu").superfish({                   //initialize the menu options            animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation            speed:       'fast',                          // faster animation speed            autoArrows:  false,                           // disable generation of arrow mark-up            dropShadows: false                            // disable drop shadows        });        $('tr:nth-child(even)').addClass('alt'); // alternating table row color    }    //+++++ - Function for showing a certain slide - ++++//    function firstSlide(i) {        $('#featured'+i+' '+'.featured_text').show(); //this constructs a css selector; for i=1, the css selector is: #featured1 .featured_text        $('#featured'+i+' '+'.featured_image').show();        switchBackgrounds('._'+i);    }    function startSliding($buttons, $transition_time) {        period = setInterval(slideEach, $transition_time);        $($buttons).click(function($eventobj, $auto) {            if (period && !$auto) clearInterval(period);        });        var i = 1;        function slideEach() {            $($buttons).filter(":eq("+i+")")                .trigger('click',[true]); //simulate click here for each slidable item            i+1 < $($buttons).length ? i++ : i = 0; //have all the items been slid?        }    }    //+++++ - Apply some effects here - ++++//    function doEff(x,y,z) {        hideSlides();        $(x+y).show();        $(x+z).fadeIn(1500); //speed in milliseconds, change if you want        $("#rounded").corner("br 12px").corner("tr 12px");//re-add rounded corners    }    //+++++ - Function switches backgrounds on links with class ._i; for i=1, the affected link clas is ._1 - ++++//    function switchBackgrounds(i) {        $('#but ul li a').css({'background-image':'url(images/nb.png)','backgroundPosition':'0 0'});        $(i).css({'background-image':'url(images/nb.png)','backgroundPosition':'-52px 0'});    }    function controlButtons($buttons) {        var totalLinks = 5;        $($buttons).click(function(event) {            for (var i=1; i<=totalLinks;i++) {                if ($(event.target).is('._'+i)) {                        doEff('#featured'+i+' ', '.featured_text','.featured_image');                        switchBackgrounds('._'+i);                }            }            return false;        });    }    function adjustDimensions() {        $('.roundit2,.roundit').each(function() {            $(this).width($(this).find('img').attr('width'));            $(this).height($(this).find('img').attr('height'));        });    }    adjustDimensions();    $('.sf-menu li:last-child a').css({'padding-right':'0px','margin-right':'0px'});});function checkUncheckAll(theElement) {    var theForm = theElement.form, z = 0;	for(z=0; z<theForm.length;z++){        if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){            theForm[z].checked = theElement.checked;	    }    }}function saveHetaTip(did) {    var hetaval = $('#HetaTip').attr('value');    $.post('/saveheta.php', {did: did, htv:hetaval}, function(data){alert(data);});}function checkNewsletterForm() {    var formObj = document.newsletterForm;    var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;	var fieldsArr = eval('({"name":"your name", "email":"your email address"})');    with(formObj) {        for(var ind in fieldsArr){            if(eval(ind).value == ''){     	        alert('Please enter ' + fieldsArr[ind]);     	        eval(ind).focus();     	        return false;            } else if(ind == 'email') {                if(filter.test(eval(ind).value)) {                    ;                } else {                    alert('Please enter a valid email address');     	            eval(ind).focus();     	            return false;                }            }        }    }    return true;}var last_form_id = 0;function createReplyForm(cid){    if(last_form_id > 0){        $('#reply_' + last_form_id).empty();        var old_h = $('#reply_' + last_form_id).parent("div").height();        $('#reply_' + last_form_id).parent("div").css('height', old_h - 70);    }    var orig_h = $('#reply_' + cid).parent("div").height();    $('#reply_' + cid).parent("div").css('height', orig_h + 70);    var str = '<br /><b>Write reply:</b><br /><form id="replyform_'+cid+'"><textarea name="Body" id="Body_'+cid+'" cols="76" rows="3"></textarea><br /><input type="button" value="Save"  onClick="javascript: saveCommentReply('+cid+');">&nbsp;<input type="button" value="Cancel" onClick="javascript: removeReplyForm('+cid+');"> <img id="img_loading" style="display: none;" src="/images/loading.gif" border="0" /><input type="hidden" name="comment_id" value="'+cid+'"></form>';    $('#reply_' + cid).html(str);   //update last id   last_form_id = cid;}function removeReplyForm(cid){    $('#reply_' + cid).empty();    var old_h = $('#reply_' + cid).parent("div").height();    $('#reply_' + cid).parent("div").css('height', old_h - 70);    last_form_id = 0;}function saveCommentReply(cid) {   if($('#Body_' + cid).val() == ''){ alert('Please enter message');$('#Body_' + cid).focus(); return false; }   $('#img_loading').show();   var form_str = $('#replyform_' + cid).serializeArray();   $('#replies_' + cid).load('/rabatt_comment_handler.php', form_str, function(data, st){removeReplyForm(cid);});}function showCuponCodePopup(code, ext_link) {    jQuery(function($) {        $('.discount_code').html(code);        $('#tempcode').css({            border: '1px solid #ccc',            padding: '4px'        })        .html(code);        //$('tempcode').html(code);        $('#codeWindow').jqm().jqmShow();        showMerchantPopup(ext_link);    });}function showMerchantPopup(ext_link){    var nwnd = window.open(ext_link, 'external', 'width=700,height=600,status=1,menubar=1,scrollbars=1,resizable=1');    nwnd.focus();}
