$(document).ready( pageLoad ); var urlPath = location.href; function pageLoad() { $(".flag").click(function() { var ex = $(this).attr('id').split('_'); setCookie('lang', ex[1], 30); location.reload(); }); $(".edit_htmlArea").htmlarea(); $(".gen_div_browseProducts").hover(function() { $(this).addClass('borderHighlight'); },function() { $(this).removeClass('borderHighlight'); }); /* FLOW PLAYER */ // flowplayer("flowPlayer_microPlus", "http://ver3.aspotigo.com/ps_image/flowplayer-3.1.1.swf"); /* shop/browse START */ $(".gen_div_browsePrev").hover(function() { $(this).addClass("gen_div_browsePrev_hover"); },function() { $(this).removeClass("gen_div_browsePrev_hover"); }); $(".gen_div_browseNext").hover(function() { $(this).addClass("gen_div_browseNext_hover"); },function() { $(this).removeClass("gen_div_browseNext_hover"); }); $(".gen_div_browsePrev").click(function() { //if ($(this).attr("class").indexOf("gen_div_browsePrev_disable", 0) >= 0) return; browseCategoryItems_prevNext($(this)); }); $(".gen_div_browseNext").click(function() { //if ($(this).attr("class").indexOf("gen_div_browseNext_disable", 0) >= 0) return; browseCategoryItems_prevNext($(this)); }); $(".gen_div_browseProductWrapper").each(function(idx) { //alert($(this).children("div").attr("class")); $(this).children("div.gen_div_browseNext").addClass("gen_div_browseNext_disable"); $(this).children("div.gen_div_browseNext").removeClass("gen_div_browseNext"); }); /* shop/browse END */ } function browseCategoryItems_prevNext(obj) { var catObj = obj.attr('id').split('_'); var type = catObj[1]; var id = catObj[2]; var butType = obj.attr('title'); var direction = 1; if (butType == "Previous") direction = -1; var catWidth = parseInt($("#gen_catList_" + id).css("width")); // width of element var leftMargin = parseInt($("#gen_catList_" + id).css("margin-left")); // get current position (margin-left) var moveWidth = parseInt($("#gen_catListWrapper_" + id).css("width")); // width of visible wrapper var newLeft = (leftMargin + (direction * moveWidth)); var leftOver = (catWidth - (newLeft*-1)); if (direction == -1) { if (obj.attr("class").indexOf("gen_div_browsePrev_disable", 0) >= 0) return; // don't do anything while the scrolling is happening if (catWidth + leftMargin > moveWidth) { // Disable left and right buttons $("#gen_prev_" + id).removeClass("gen_div_browsePrev").addClass("gen_div_browsePrev_disable"); $("#gen_next_" + id).addClass ("gen_div_browseNext_disable"); $("#gen_catList_" + id).animate({ marginLeft: newLeft + "px" }, 1000, null, function() { if (catWidth + leftMargin > moveWidth) { if ((catWidth + leftMargin - moveWidth) > moveWidth) { $("#gen_prev_" + id).addClass("gen_div_browsePrev").removeClass("gen_div_browsePrev_disable"); // enable left button } $("#gen_next_" + id).addClass("gen_div_browseNext").removeClass("gen_div_browseNext_disable"); // enable right button } } ); } } else { if (obj.attr("class").indexOf("gen_div_browseNext_disable", 0) >= 0) return; // don't do anything while the scrolling is happening if ((leftMargin*-1) >= moveWidth) { // Disable left and right buttons $("#gen_next_" + id).removeClass("gen_div_browseNext").addClass("gen_div_browseNext_disable"); $("#gen_prev_" + id).addClass ("gen_div_browsePrev_disable"); $("#gen_catList_" + id).animate({ marginLeft: newLeft + "px" }, 1000, null, function() { if ((leftMargin*-1) >= moveWidth) { if ((leftMargin*-1)>moveWidth) { $("#gen_next_" + id).addClass("gen_div_browseNext").removeClass("gen_div_browseNext_disable"); // enable right button } $("#gen_prev_" + id).addClass("gen_div_browsePrev").removeClass("gen_div_browsePrev_disable"); // enable left button } } ); } } // alert( parseInt($("#gen_catList_" + id).css("margin-left")) ); //margin-left:-192px; //alert(obj.parent('li').css('background-color', 'red')); /* var mStr = "func=ajax&type=testAJAX"; $.ajax({ type: "POST", url:"index.php", dataType: "xml", data: mStr, success: function(xml) { var result = $(xml).find('result').text(); var desc = $(xml).find('desc' ).text(); if (result == 1) { alert("ERROR\n\n" + desc); } else { alert('hi'); } } }); var li = "
"; //, addslashes($db2->f("product_name"))); li += "
product_name
"; //, $sess->url($url), $db2->f("product_name")); //if ($db2->f("product_thumb_image")) { li += "
"; //, $sess->url($url)); //} li += "
"; if (type == "next") { $("#gen_catList_" + id + " li").last().remove(); $("#gen_catList_" + id).prepend('
  • ' + li + '
  • '); } else if (type == "prev") { $("#gen_catList_" + id + " li").first().remove(); $("#gen_catList_" + id).append('
  • ' + li + '
  • '); } */ } function eraseCookie(name) { setCookie(name,"",-1); } function setCookie(c_name,value,exdays) { var exdate=new Date(); exdate.setDate(exdate.getDate() + exdays); var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()); document.cookie=c_name + "=" + c_value; } function setCookieHour(c_name,value,exhours) { var now = new Date(); var time = now.getTime(); time += ((60*60*exhours)*1000); now.setTime(time); var c_value=escape(value) + ((exhours==null) ? "" : "; expires="+ now.toGMTString()); //exdate.toUTCString()); document.cookie=c_name + "=" + c_value; } function getCookie(c_name) { var i,x,y,ARRcookies=document.cookie.split(";"); for (i=0;i