function sack(file){this.xmlhttp=null;this.resetData=function(){this.method="POST";this.queryStringSeparator="?";this.argumentSeparator="&";this.URLString="";this.encodeURIString=true;this.execute=false;this.element=null;this.elementObj=null;this.requestFile=file;this.vars=new Object();this.responseStatus=new Array(2);};this.resetFunctions=function(){this.onLoading=function(){};this.onLoaded=function(){};this.onInteractive=function(){};this.onCompletion=function(){};this.onError=function(){};this.onFail=function(){};};this.reset=function(){this.resetFunctions();this.resetData();};this.createAJAX=function(){try{this.xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e1){try{this.xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e2){this.xmlhttp=null;}}
if(!this.xmlhttp){if(typeof XMLHttpRequest!="undefined"){this.xmlhttp=new XMLHttpRequest();}else{this.failed=true;}}};this.setVar=function(name,value){this.vars[name]=Array(value,false);};this.encVar=function(name,value,returnvars){if(true==returnvars){return Array(encodeURIComponent(name),encodeURIComponent(value));}else{this.vars[encodeURIComponent(name)]=Array(encodeURIComponent(value),true);}}
this.processURLString=function(string,encode){encoded=encodeURIComponent(this.argumentSeparator);regexp=new RegExp(this.argumentSeparator+"|"+encoded);varArray=string.split(regexp);for(i=0;i<varArray.length;i++){urlVars=varArray[i].split("=");if(true==encode){this.encVar(urlVars[0],urlVars[1]);}else{this.setVar(urlVars[0],urlVars[1]);}}}
this.createURLString=function(urlstring){if(this.encodeURIString&&this.URLString.length){this.processURLString(this.URLString,true);}
if(urlstring){if(this.URLString.length){this.URLString+=this.argumentSeparator+urlstring;}else{this.URLString=urlstring;}}
this.setVar("rndval",new Date().getTime());urlstringtemp=new Array();for(key in this.vars){if(false==this.vars[key][1]&&true==this.encodeURIString){encoded=this.encVar(key,this.vars[key][0],true);delete this.vars[key];this.vars[encoded[0]]=Array(encoded[1],true);key=encoded[0];}
urlstringtemp[urlstringtemp.length]=key+"="+this.vars[key][0];}
if(urlstring){this.URLString+=this.argumentSeparator+urlstringtemp.join(this.argumentSeparator);}else{this.URLString+=urlstringtemp.join(this.argumentSeparator);}}
this.runResponse=function(){eval(this.response);}
this.runAJAX=function(urlstring){if(this.failed){this.onFail();}else{this.createURLString(urlstring);if(this.element){this.elementObj=document.getElementById(this.element);}
if(this.xmlhttp){var self=this;if(this.method=="GET"){totalurlstring=this.requestFile+this.queryStringSeparator+this.URLString;this.xmlhttp.open(this.method,totalurlstring,true);}else{this.xmlhttp.open(this.method,this.requestFile,true);try{this.xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}catch(e){}}
this.xmlhttp.onreadystatechange=function(){switch(self.xmlhttp.readyState){case 1:self.onLoading();break;case 2:self.onLoaded();break;case 3:self.onInteractive();break;case 4:self.response=self.xmlhttp.responseText;self.responseXML=self.xmlhttp.responseXML;self.responseStatus[0]=self.xmlhttp.status;self.responseStatus[1]=self.xmlhttp.statusText;if(self.execute){self.runResponse();}
if(self.elementObj){elemNodeName=self.elementObj.nodeName;elemNodeName.toLowerCase();if(elemNodeName=="input"||elemNodeName=="select"||elemNodeName=="option"||elemNodeName=="textarea"){self.elementObj.value=self.response;}else{self.elementObj.innerHTML=self.response;}}
if(self.responseStatus[0]=="200"){self.onCompletion();}else{self.onError();}
self.URLString="";break;}};this.xmlhttp.send(this.URLString);}}};this.reset();this.createAJAX();}
function useronline_init(){if(document.getElementById('useronline-count')!=null){setInterval("get_useronline_count()",useronline_timeout);}
if(document.getElementById('useronline-browsing-site')!=null){setInterval("get_useronline_browsingsite()",useronline_timeout);}
if(document.getElementById('useronline-browsing-page')!=null){setInterval("get_useronline_browsingpage()",useronline_timeout);}}
function get_useronline_count(){useronline_count=new sack(useronline_ajax_url);useronline_count.setVar("useronline_mode",'useronline_count');useronline_count.method='GET';useronline_count.element='useronline-count';useronline_count.runAJAX();useronline_count=null;}
function get_useronline_browsingsite(){useronline_browsingsite=new sack(useronline_ajax_url);useronline_browsingsite.setVar("useronline_mode",'useronline_browsingsite');useronline_browsingsite.method='GET';useronline_browsingsite.element='useronline-browsing-site';useronline_browsingsite.runAJAX();useronline_browsingsite=null;}
function get_useronline_browsingpage(){useronline_browsingpage=new sack(useronline_ajax_url);useronline_browsingpage.setVar("useronline_mode",'useronline_browsingpage');useronline_browsingpage.method='GET';useronline_browsingpage.element='useronline-browsing-page';useronline_browsingpage.runAJAX();useronline_browsingpage=null;}
addLoadEvent=function(f){var old=window.onload;if(typeof old!='function'){window.onload=f;}else{window.onload=function(){f();};}};addLoadEvent(useronline_init);var al_status;var al_loginForm,al_registerForm,al_lostPasswordForm;var al_loginMessage,al_registerMessage,al_lostPasswordMessage;var al_sack=new sack();var al_otheronload=window.onload;window.onload=al_init;function al_init(){al_status=0;al_loginForm=document.getElementById("al_loginForm");al_registerForm=document.getElementById("al_registerForm");al_lostPasswordForm=document.getElementById("al_lostPasswordForm");al_loginMessage=document.getElementById("al_loginMessage");al_registerMessage=document.getElementById("al_registerMessage");al_lostPasswordMessage=document.getElementById("al_lostPasswordMessage");}
function al_showLogin(){document.getElementById("al_login").style.display="none";document.getElementById("al_register").style.display="none";document.getElementById("al_lostPassword").style.display="none";if(0!=al_timeout){document.getElementById("al_loading").style.display="block";setTimeout('al_showLogin2();',al_timeout);}else{al_showLogin2();}}
function al_showLogin2(){document.getElementById("al_loading").style.display="none";document.getElementById("al_login").style.display="block";al_loginForm.log.focus();}
function al_showRegister(){document.getElementById("al_login").style.display="none";document.getElementById("al_register").style.display="none";document.getElementById("al_lostPassword").style.display="none";if(0!=al_timeout){document.getElementById("al_loading").style.display="block";setTimeout('al_showRegister2();',al_timeout);}else{al_showRegister2();}}
function al_showRegister2(){document.getElementById("al_loading").style.display="none";document.getElementById("al_register").style.display="block";al_registerForm.user_login.focus();}
function al_showLostPassword(){document.getElementById("al_login").style.display="none";document.getElementById("al_register").style.display="none";document.getElementById("al_lostPassword").style.display="none";if(0!=al_timeout){document.getElementById("al_loading").style.display="block";setTimeout('al_showLostPassword2();',al_timeout);}else{al_showLostPassword2();}}
function al_showLostPassword2(){document.getElementById("al_loading").style.display="none";document.getElementById("al_lostPassword").style.display="block";al_lostPasswordForm.user_login.focus();}
function al_login(){if(0!=al_status){return;}
if(al_loginForm.log.value==''){alert("Please enter username.");al_loginForm.log.focus();return;}
if(al_loginForm.pwd.value==''){alert("Please enter password.");al_loginForm.pwd.focus();return;}
al_sack.setVar("log",al_loginForm.log.value);al_sack.setVar("pwd",al_loginForm.pwd.value);al_sack.setVar("rememberme",al_loginForm.rememberme.value);al_sack.requestFile=al_base_uri+"/content/plugins/login/login.php";al_sack.method="POST";al_sack.onError=al_ajaxError;al_sack.onCompletion=al_loginHandleResponse;al_sack.runAJAX();al_status=1;}
function al_loginHandleResponse(){al_status=0;var responselines=al_sack.response.split("\n",2);if(responselines[0]==al_failure){alert(responselines[1]);return;}
if(responselines[0]==al_success){if(al_redirectOnLogin=='')
window.location.reload(true);else
window.location.href=al_redirectOnLogin;return;}
alert("Unknown login response.");}
function al_register(){if(0!=al_status){return;}
if(al_registerForm.user_login.value==''){alert("Please enter user ID.");al_registerForm.user_login.focus();return;}
if(al_registerForm.user_email.value==''){alert("Please enter e-mail address.");al_registerForm.user_email.focus();return;}
if(al_registerForm.user_first_name.value==''){alert("Please enter your first name.");al_registerForm.user_first_name.focus();return;}
if(al_registerForm.user_last_name.value==''){alert("Please enter your last name.");al_registerForm.user_last_name.focus();return;}
al_sack.setVar("user_login",al_registerForm.user_login.value);al_sack.setVar("user_email",al_registerForm.user_email.value);al_sack.setVar("user_first_name",al_registerForm.user_first_name.value);al_sack.setVar("user_last_name",al_registerForm.user_last_name.value);al_sack.setVar("user_address",al_registerForm.user_address.value);al_sack.setVar("user_city",al_registerForm.user_city.value);al_sack.setVar("user_phone",al_registerForm.user_phone.value);al_sack.setVar("user_id_reseller",al_registerForm.user_id_reseller.value);al_sack.requestFile=al_base_uri+"/content/plugins/login/register.php";al_sack.method="POST";al_sack.onError=al_ajaxError;al_sack.onCompletion=al_registerHandleResponse;al_sack.runAJAX();al_status=1;}
function al_registerHandleResponse(){al_status=0;var responselines=al_sack.response.split("\n",2);if(responselines[0]==al_failure){alert(responselines[1]);return;}
if(responselines[0]==al_success){alert("Registration complete. Please check your e-mail.");al_loginMessage.innerHTML="Your password is in your mail.<br/>";al_loginForm.log.value=al_registerForm.user_login.value;al_registerForm.user_login.value="";al_registerForm.user_email.value="";al_registerForm.user_first_name.value="";al_registerForm.user_last_name.value="";al_registerForm.user_address.value="";al_registerForm.user_city.value="";al_registerForm.user_phone.value="";al_registerForm.user_id_reseller.value="";al_showLogin();al_loginForm.pwd.focus();return;}
alert("Unknown registration response.");}
function al_retrievePassword(){if(0!=al_status){return;}
if(al_lostPasswordForm.user_login.value==''){alert("Please enter username.");al_lostPasswordForm.user_login.focus();return;}
if(al_lostPasswordForm.user_email.value==''){alert("Please enter e-mail address.");al_lostPasswordForm.user_email.focus();return;}
al_sack.setVar("user_login",al_lostPasswordForm.user_login.value);al_sack.setVar("user_email",al_lostPasswordForm.user_email.value);al_sack.requestFile=al_base_uri+"/content/plugins/login/lostpassword.php";al_sack.method="POST";al_sack.onError=al_ajaxError;al_sack.onCompletion=al_lostPasswordHandleResponse;al_sack.runAJAX();al_status=1;}
function al_lostPasswordHandleResponse(){al_status=0;var responselines=al_sack.response.split("\n",2);if(responselines[0]==al_failure){alert(responselines[1]);return;}
if(responselines[0]==al_success){alert("Check your e-mail for the confirmation link.");al_loginMessage.innerHTML="Your confirmation link is in your mail.<br/>";al_loginForm.log.value=al_lostPasswordForm.user_login.value;al_lostPasswordForm.user_login.value="";al_lostPasswordForm.user_email.value="";al_showLogin();al_loginForm.pwd.focus();return;}
alert("Unknown password retrieval response.");}
function al_ajaxError(){alert("We are sorry, there was an error while sending the request.\nPlease try again!\nIf error persists, please contact the webmaster.");alert(al_sack.responseStatus[0]+':\n'+al_sack.response);al_sack=new sack();}
function al_loginOnEnter(e){if(window.event)
keynum=e.keyCode;else if(e.which)
keynum=e.which;else
keynum=0;if(keynum==13)
al_login();}
function al_registerOnEnter(e){if(window.event)
keynum=e.keyCode;else if(e.which)
keynum=e.which;else
keynum=0;if(keynum==13)
al_register();}
function al_retrievePasswordOnEnter(e){if(window.event)
keynum=e.keyCode;else if(e.which)
keynum=e.which;else
keynum=0;if(keynum==13)
al_retrievePassword();}
jQuery(document).ready(function(){jQuery('div.vtforms > form').ajaxForm({beforeSubmit:vtformsBeforeSubmit,dataType:'json',success:vtformsProcessJson});jQuery('div.vtforms > form').each(function(i,n){vtformsToggleSubmit(jQuery(n));});});function vtformsExclusiveCheckbox(elem){jQuery(elem.form).find('input:checkbox[@name="'+elem.name+'"]').not(elem).removeAttr('checked');}
function vtformsToggleSubmit(form){var submit=jQuery(form).find('input:submit');if(!submit.length)return;var acceptances=jQuery(form).find('input:checkbox.vtforms-acceptance');if(!acceptances.length)return;submit.removeAttr('disabled');acceptances.each(function(i,n){n=jQuery(n);if(n.hasClass('vtforms-invert')&&n.is(':checked')||!n.hasClass('vtforms-invert')&&!n.is(':checked'))
submit.attr('disabled','disabled');});}
function vtformsBeforeSubmit(formData,jqForm,options){vtformsClearResponseOutput();jQuery('img.ajax-loader',jqForm[0]).css({visibility:'visible'});formData.push({name:'_vtforms_is_ajax_call',value:1});return true;}
function vtformsNotValidTip(into,message){jQuery(into).append('<span class="vtforms-not-valid-tip">'+message+'</span>');jQuery('span.vtforms-not-valid-tip').mouseover(function(){jQuery(this).fadeOut('fast');});jQuery(into).find(':input').mouseover(function(){jQuery(into).find('.vtforms-not-valid-tip').not(':hidden').fadeOut('fast');});jQuery(into).find(':input').focus(function(){jQuery(into).find('.vtforms-not-valid-tip').not(':hidden').fadeOut('fast');});}
function vtformsProcessJson(data){var vtformsResponseOutput=jQuery(data.into).find('div.vtforms-response-output');vtformsClearResponseOutput();if(data.invalids){jQuery.each(data.invalids,function(i,n){vtformsNotValidTip(jQuery(data.into).find(n.into),n.message);});vtformsResponseOutput.addClass('vtforms-validation-errors');}
if(data.captcha){jQuery.each(data.captcha,function(i,n){jQuery(data.into).find(':input[@name="'+i+'"]').clearFields();jQuery(data.into).find('img.vtforms-captcha-'+i).attr('src',n);var match=/([0-9]+)\.(png|gif|jpeg)$/.exec(n);jQuery(data.into).find('input:hidden[@name="_vtforms_captcha_challenge_'+i+'"]').attr('value',match[1]);});}
if(1==data.spam){vtformsResponseOutput.addClass('vtforms-spam-blocked');}
if(1==data.mailSent){jQuery(data.into).find('form').resetForm().clearForm();vtformsResponseOutput.addClass('vtforms-mail-sent-ok');}else{vtformsResponseOutput.addClass('vtforms-mail-sent-ng');}
vtformsResponseOutput.append(data.message).fadeIn('fast');}
function vtformsClearResponseOutput(){jQuery('div.vtforms-response-output').hide().empty().removeClass('vtforms-mail-sent-ok vtforms-mail-sent-ng vtforms-validation-errors vtforms-spam-blocked');jQuery('span.vtforms-not-valid-tip').remove();jQuery('img.ajax-loader').css({visibility:'hidden'});}
jQuery(document).ready(TB_init);function TB_init(){jQuery("a.thickbox").click(function(event){event.preventDefault();this.blur();var caption=this.title||this.name||"";var group=this.rel||false;TB_show(caption,this.href,group);});}
function TB_show(caption,url,rel){if(!jQuery("#TB_HideSelect").length){jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");jQuery("#TB_overlay").click(TB_remove);}
jQuery(window).scroll(TB_position);TB_overlaySize();jQuery("body").append("<div id='TB_load'><img src='"+fileThickboxLoadingImage+"' /></div>");TB_load_position();var baseURL=url.match(/(.+)?/)[1]||url;var imageURL=/\.(jpe?g|png|gif|bmp)/gi;if(baseURL.match(imageURL)){var dummy={caption:"",url:"",html:""};var prev=dummy,next=dummy,imageCount="";if(rel){function getInfo(image,id,label){return{caption:image.title,url:image.href,html:"<span id='TB_"+id+"'>&nbsp;&nbsp;<a href='#'>"+label+"</a></span>"}}
var imageGroup=jQuery("a[@rel="+rel+"]").get();var foundSelf=false;var imageTitle='Gallery';for(var i=0;i<imageGroup.length;i++){var image=imageGroup[i];var urlTypeTemp=image.href.match(imageURL);if(image.href==url){foundSelf=true;imageCount="Image "+(i+1)+" of "+(imageGroup.length);if(image.rel!=null)
{imageTitle=image.rel.replace(/_/," ");}}else{if(foundSelf){next=getInfo(image,"next","Next &gt;");break;}else{prev=getInfo(image,"prev","&lt; Prev");}}}}
imgPreloader=new Image();imgPreloader.onload=function(){imgPreloader.onload=null;var pagesize=TB_getPageSize();var x=pagesize[0]-150;var y=pagesize[1]-150;var imageWidth=imgPreloader.width;var imageHeight=imgPreloader.height;if(imageWidth>x){imageHeight=imageHeight*(x/imageWidth);imageWidth=x;if(imageHeight>y){imageWidth=imageWidth*(y/imageHeight);imageHeight=y;}}else if(imageHeight>y){imageWidth=imageWidth*(y/imageHeight);imageHeight=y;if(imageWidth>x){imageHeight=imageHeight*(x/imageWidth);imageWidth=x;}}
if(imageGroup.length>1)
{TB_WIDTH=imageWidth+30+76+18;TB_HEIGHT=imageHeight+60;if(jQuery.browser.msie)
{TB_HEIGHT+=30;if(navigator.appVersion.match(/MSIE\s6\.0/)=="MSIE 6.0")
{TB_WIDTH+=20;}}
thumbPreloader=Array();additional_links="<div id='TB_additional_images'>";var thumb_x=76;var thumb_y=imageHeight;for(var i=0;i<imageGroup.length;i++){var image=imageGroup[i];var image_selected="";if(image.href==url){image_selected="class='TB_Selected'";}
thumbPreloader[i]=new Image();thumbPreloader[i].onload=function(){}
thumbPreloader[i].src=image.href;var thumbImgWidth=thumbPreloader[i].width;var thumbImgHeight=thumbPreloader[i].height;if(thumbImgWidth>thumb_x){thumbImgHeight=thumbImgHeight*(thumb_x/thumbImgWidth);thumbImgWidth=thumb_x;if(thumbImgHeight>thumb_y){thumbImgWidth=thumbImgWidth*(thumb_y/thumbImgHeight);thumbImgHeight=thumb_y;}}
additional_links+="<a href='#' "+image_selected+" id='TB_ThumbnailLink_"+i+"' ><img class='TB_Thumbnail_Image' src='"+image.href+"' width='"+thumbImgWidth+"' height='"+thumbImgHeight+"' alt=''/></a>";}
additional_links+="</div>";jQuery("#TB_window").append("<div id='TB_Header'><div id='TB_TopCloseAjaxWindow'><a href='#' id='TB_TopCloseWindowButton' title='Close'>close</a></div>"+imageTitle+"</div>");jQuery("#TB_window").append(additional_links);jQuery("#TB_TopCloseWindowButton").click(TB_remove);}
else
{TB_WIDTH=imageWidth+30;TB_HEIGHT=imageHeight+60;}
jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>"+"<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>"+imageCount+prev.html+next.html+"</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a></div>");jQuery("#TB_closeWindowButton").click(TB_remove);function buildClickHandler(image){return function(){jQuery("#TB_window").remove();jQuery("body").append("<div id='TB_window'></div>");TB_show(image.caption,image.url,rel);return false;};}
if(imageGroup.length>1)
{goImage=Array();for(var i=0;i<imageGroup.length;i++){goImage[i]=buildClickHandler(getInfo(imageGroup[i],"image_"+i+"",""));jQuery("#TB_ThumbnailLink_"+i+"").click(goImage[i]);}}
var goPrev=buildClickHandler(prev);var goNext=buildClickHandler(next);if(prev.html){jQuery("#TB_prev").click(goPrev);}
if(next.html){jQuery("#TB_next").click(goNext);}
document.onkeydown=function(e){if(e==null){keycode=event.keyCode;}else{keycode=e.which;}
switch(keycode){case 27:TB_remove();break;case 190:if(next.html){document.onkeydown=null;goNext();}
break;case 188:if(prev.html){document.onkeydown=null;goPrev();}
break;}}
TB_position();jQuery("#TB_load").remove();jQuery("#TB_ImageOff").click(TB_remove);jQuery("#TB_window").css({display:"block"});}
imgPreloader.src=url;}else{var queryString=url.match(/\?(.+)/)[1];var params=TB_parseQuery(queryString);TB_WIDTH=(params['width']*1)+30;TB_HEIGHT=(params['height']*1)+40;var ajaxContentW=TB_WIDTH-30,ajaxContentH=TB_HEIGHT-45;if(url.indexOf('TB_iframe')!=-1){urlNoQuery=url.split('TB_');jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent' style='width:"+(ajaxContentW+29)+"px;height:"+(ajaxContentH+17)+"px;' onload='TB_showIframe()'> </iframe>");}else{jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");}
jQuery("#TB_closeWindowButton").click(TB_remove);if(url.indexOf('TB_inline')!=-1){jQuery("#TB_ajaxContent").html(jQuery('#'+params['inlineId']).html());TB_position();jQuery("#TB_load").remove();jQuery("#TB_window").css({display:"block"});}else if(url.indexOf('TB_iframe')!=-1){TB_position();if(frames['TB_iframeContent']==undefined){jQuery("#TB_load").remove();jQuery("#TB_window").css({display:"block"});jQuery(document).keyup(function(e){var key=e.keyCode;if(key==27){TB_remove()}});}}else{jQuery("#TB_ajaxContent").load(url,function(){TB_position();jQuery("#TB_load").remove();jQuery("#TB_window").css({display:"block"});});}}
jQuery(window).resize(TB_position);document.onkeyup=function(e){if(e==null){keycode=event.keyCode;}else{keycode=e.which;}
if(keycode==27){TB_remove();}}}
function TB_showIframe(){jQuery("#TB_load").remove();jQuery("#TB_window").css({display:"block"});}
function TB_remove(){jQuery("#TB_imageOff").unbind("click");jQuery("#TB_overlay").unbind("click");jQuery("#TB_closeWindowButton").unbind("click");jQuery("#TB_TopCloseWindowButton").unbind("click");jQuery("#TB_window").fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').remove();});jQuery("#TB_load").remove();return false;}
function TB_position(){var pagesize=TB_getPageSize();var arrayPageScroll=TB_getPageScrollTop();var style={width:TB_WIDTH,left:(arrayPageScroll[0]+(pagesize[0]-TB_WIDTH)/2),top:(arrayPageScroll[1]+(pagesize[1]-TB_HEIGHT)/2)};jQuery("#TB_window").css(style);}
function TB_overlaySize(){if(window.innerHeight&&window.scrollMaxY||window.innerWidth&&window.scrollMaxX){yScroll=window.innerHeight+window.scrollMaxY;xScroll=window.innerWidth+window.scrollMaxX;var deff=document.documentElement;var wff=(deff&&deff.clientWidth)||document.body.clientWidth||window.innerWidth||self.innerWidth;var hff=(deff&&deff.clientHeight)||document.body.clientHeight||window.innerHeight||self.innerHeight;xScroll-=(window.innerWidth-wff);yScroll-=(window.innerHeight-hff);}else if(document.body.scrollHeight>document.body.offsetHeight||document.body.scrollWidth>document.body.offsetWidth){yScroll=document.body.scrollHeight;xScroll=document.body.scrollWidth;}else{yScroll=document.body.offsetHeight;xScroll=document.body.offsetWidth;}
jQuery("#TB_overlay").css({"height":yScroll,"width":xScroll});jQuery("#TB_HideSelect").css({"height":yScroll,"width":xScroll});}
function TB_load_position(){var pagesize=TB_getPageSize();var arrayPageScroll=TB_getPageScrollTop();jQuery("#TB_load").css({left:(arrayPageScroll[0]+(pagesize[0]-100)/2),top:(arrayPageScroll[1]+((pagesize[1]-100)/2))}).css({display:"block"});}
function TB_parseQuery(query){if(!query)
return{};var params={};var pairs=query.split(/[;&]/);for(var i=0;i<pairs.length;i++){var pair=pairs[i].split('=');if(!pair||pair.length!=2)
continue;params[unescape(pair[0])]=unescape(pair[1]).replace(/\+/g,' ');}
return params;}
function TB_getPageScrollTop(){var yScrolltop;var xScrollleft;if(self.pageYOffset||self.pageXOffset){yScrolltop=self.pageYOffset;xScrollleft=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop||document.documentElement.scrollLeft){yScrolltop=document.documentElement.scrollTop;xScrollleft=document.documentElement.scrollLeft;}else if(document.body){yScrolltop=document.body.scrollTop;xScrollleft=document.body.scrollLeft;}
arrayPageScroll=new Array(xScrollleft,yScrolltop)
return arrayPageScroll;}
function TB_getPageSize(){var de=document.documentElement;var w=window.innerWidth||self.innerWidth||(de&&de.clientWidth)||document.body.clientWidth;var h=window.innerHeight||self.innerHeight||(de&&de.clientHeight)||document.body.clientHeight
arrayPageSize=new Array(w,h)
return arrayPageSize;}
var testsuccess=0;var lnid=new Array();function categorylist(url)
{self.location=url;}
var noresults=function(results)
{return true;}
var changetaxntotal=function(results){prices=results.split(':');total=parseFloat(prices[0])+parseFloat(prices[1])+parseFloat(prices[2]);var total=roundNumber(total,2)
var tax=roundNumber(prices[0],2)
tax=tax.toFixed(2);total=total.toFixed(2);document.getElementById('checkout_tax').innerHTML="<span class='pricedisplay'>$"+tax+"</span>";document.getElementById('checkout_total').innerHTML="<span class='pricedisplay'>$"+total+"</span>";return true;}
function roundNumber(num,dec){var result=Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);return result;}
var getresults=function(results)
{eval(results);if(window.drag_and_drop_cart_updater)
{drag_and_drop_cart_updater();}
if(document.getElementById('loadingimage')!=null)
{document.getElementById('loadingindicator').style.visibility='hidden';}
else if(document.getElementById('alt_loadingimage')!=null)
{document.getElementById('alt_loadingindicator').style.visibility='hidden';}
if((document.getElementById('sliding_cart')!=null)&&(document.getElementById('sliding_cart').style.display=='none'))
{jQuery("#fancy_collapser").attr("src",(MTOC_URL+"/images/minus.png"));jQuery("#sliding_cart").show("fast",function(){ajax.post("index.php",noresults,"ajax=true&set_slider=true&state=1");});}
if(document.getElementById('fancy_notification')!=null)
{jQuery('#loading_animation').css("display",'none');}}
function set_billing_country(html_form_id,form_id)
{var billing_region='';country=jQuery(("div#"+html_form_id+" select[@class=current_country]")).val();region=jQuery(("div#"+html_form_id+" select[@class=current_region]")).val();if(/[\d]{1,6}/.test(region))
{billing_region="&billing_region="+region;}
ajax.post("index.php",getresults,("ajax=true&form_id="+form_id+"&billing_country="+country+billing_region));ajax.post("index.php",changetaxntotal,("ajax=true&changetax=true&form_id="+form_id+"&billing_country="+country+billing_region));}
function submitform(frm,show_notification)
{if(show_notification!=false)
{show_notification=true;}
ajax.post("index.php?ajax=true&user=true",getresults,ajax.serialize(frm));if(document.getElementById('loadingimage')!=null)
{document.getElementById('loadingimage').src=MTOC_URL+'/images/indicator.gif';document.getElementById('loadingindicator').style.visibility='visible';}
else if(document.getElementById('alt_loadingimage')!=null)
{document.getElementById('alt_loadingimage').src=MTOC_URL+'/images/indicator.gif';document.getElementById('alt_loadingindicator').style.visibility='visible';}
if((show_notification==true)&&(document.getElementById('fancy_notification')!=null))
{var options={margin:1,border:1,padding:1,scroll:1};form_button_id=frm.id+"_submit_button";var container_offset={};new_container_offset=jQuery('#products_page_container').offset(options,container_offset);if(container_offset['left']==null){container_offset['left']=new_container_offset.left;container_offset['top']=new_container_offset.top;}
var button_offset={};new_button_offset=jQuery('#'+form_button_id).offset(options,button_offset)
if(button_offset['left']==null){button_offset['left']=new_button_offset.left;button_offset['top']=new_button_offset.top;}
jQuery('#fancy_notification').css("left",(button_offset['left']-container_offset['left']+10)+'px');jQuery('#fancy_notification').css("top",((button_offset['top']-container_offset['top'])-60)+'px');jQuery('#fancy_notification').css("display",'block');jQuery('#loading_animation').css("display",'block');jQuery('#fancy_notification_content').css("display",'none');}
return false;}
function emptycart(){ajax.post("index.php",getresults,"ajax=true&user=true&emptycart=true&current_page="+window.location+"");if(document.getElementById('loadingimage')!=null){document.getElementById('loadingimage').src=MTOC_URL+'/images/indicator.gif';document.getElementById('loadingindicator').style.visibility='visible';}else if(document.getElementById('alt_loadingimage')!=null){document.getElementById('alt_loadingimage').src=MTOC_URL+'/images/indicator.gif';document.getElementById('alt_loadingindicator').style.visibility='visible';}}
function show_additional_description(id,image_id)
{currentstate=document.getElementById(id).style.display;if(currentstate!='inline')
{document.getElementById(id).style.display='inline';document.getElementById(image_id).src=MTOC_URL+'/images/icon_window_collapse.gif';}
else
{document.getElementById(id).style.display='none';document.getElementById(image_id).src=MTOC_URL+'/images/icon_window_expand.gif';}
return false;}
function prodgroupswitch(state)
{if(state=='brands')
{jQuery('.categorydisplay').css("display",'none');jQuery('.branddisplay').css("display",'block');}
else if(state=='categories')
{jQuery('.categorydisplay').css("display",'block');jQuery('.branddisplay').css("display",'none');}
return false;}
var previous_rating;function ie_rating_rollover(id,state)
{target_element=document.getElementById(id);switch(state)
{case 1:previous_rating=target_element.style.background;target_element.style.background="url("+MTOC_URL+"/images/blue-star.gif)";break;default:if(target_element.style.background!="url("+MTOC_URL+"/images/gold-star.gif)")
{target_element.style.background=previous_rating;}
break;}}
var apply_rating=function(results)
{outarr=results.split(",");for(i=1;i<=outarr[1];i++)
{id="star"+outarr[0]+"and"+i+"_link";document.getElementById(id).style.background="url("+MTOC_URL+"/images/gold-star.gif)";}
for(i=5;i>outarr[1];i--)
{id="star"+outarr[0]+"and"+i+"_link";document.getElementById(id).style.background="#c4c4b8";}
lnid[outarr[0]]=1;rating_id='rating_'+outarr[0]+'_text';if(document.getElementById(rating_id).innerHTML!="Your Rating:")
{document.getElementById(rating_id).innerHTML="Your Rating:";}
saved_id='saved_'+outarr[0]+'_text';document.getElementById(saved_id).style.display="inline";update_vote_count(outarr[0]);}
function hide_save_indicator(id)
{document.getElementById(id).style.display="none";}
function rate_item(prodid,rating)
{ajax.post("index.php",apply_rating,"ajax=true&rate_item=true&product_id="+prodid+"&rating="+rating);}
function update_vote_count(prodid)
{var update_vote_count=function(results)
{outarr=results.split(",");vote_count=outarr[0];prodid=outarr[1];vote_count_id='vote_total_'+prodid;document.getElementById(vote_count_id).innerHTML=vote_count;}
ajax.post("index.php",update_vote_count,"ajax=true&get_rating_count=true&product_id="+prodid);}
function submit_change_country()
{document.forms.change_country.submit();}
function update_preview_url(prodid)
{image_height=document.getElementById("image_height").value;image_width=document.getElementById("image_width").value;if(((image_height>0)&&(image_height<=1024))&&((image_width>0)&&(image_width<=1024)))
{new_url="index.php?productid="+prodid+"&height="+image_height+"&width="+image_width+"";document.getElementById("preview_link").setAttribute('href',new_url);}
else
{new_url="index.php?productid="+prodid+"";document.getElementById("preview_link").setAttribute('href',new_url);}
return false;}
function change_variation(product_id,variation_ids,special){value_ids='';special_prefix="";if(special==true){form_id="specials_"+product_id;}else{form_id="product_"+product_id;}
var j=0;for(var i in variation_ids){if(!isNaN(parseInt(i))){j+=1;variation_name="variation["+variation_ids[i]+"]";value_ids+="&variation[]="+document.getElementById(form_id).elements[variation_name].value;}}
if(special==true){var return_price=function(results){eval(results);if(product_id!=null){target_id="special_product_price_"+product_id;buynow_id="BB_BuyButtonForm"+product_id;/*document.getElementById(target_id).firstChild.innerHTML=price;*/if(price.substring(27,price.indexOf("&"))!='')
document.getElementById(buynow_id).item_price_1.value=price.substring(27,price.indexOf("&"));}}}else{var return_price=function(results){eval(results);if(product_id!=null){target_id="product_price_"+product_id;buynow_id="BB_BuyButtonForm"+product_id;document.getElementById(target_id).firstChild.innerHTML=price;if(price.substring(27,price.indexOf("&"))!=''){document.getElementById(form_id).item_price_1.value=price.substring(27,price.indexOf("&"));}
var resellerprice_loc=resellerpoin1_loc=resellerpoin2_loc=resellerpoin3_loc="";
var theprice="";
var variation_name=variation_name_1=variation_name_2="";
if(j==2){variation_name_1 = "variation["+variation_ids[0]+"]";variation_name_2 = "variation["+variation_ids[1]+"]";}
else
if(j==1){variation_name = "variation["+variation_ids[0]+"]";}
if(j==2){price = document.getElementById("variation_"+product_id+"_"+document.getElementById(form_id).elements[variation_name_1].value+"_"+document.getElementById(form_id).elements[variation_name_2].value+"_price").value;
 if(document.getElementById("variation_"+product_id+"_"+document.getElementById(form_id).elements[variation_name_1].value+"_"+document.getElementById(form_id).elements[variation_name_2].value+"_special").value=='1'){
  specialprice=document.getElementById("variation_"+product_id+"_"+document.getElementById(form_id).elements[variation_name_1].value+"_"+document.getElementById(form_id).elements[variation_name_2].value+"_special_price").value;
  price="<span class='oldprice'>"+price+"</span><br/>Harga: "+specialprice;
 }
}
else if(j==1){price=document.getElementById("variation_"+product_id+"_"+document.getElementById(form_id).elements[variation_name].value+"_price").value;
 if(document.getElementById("variation_"+product_id+"_"+document.getElementById(form_id).elements[variation_name].value+"_special").value=='1'){
  specialprice=document.getElementById("variation_"+product_id+"_"+document.getElementById(form_id).elements[variation_name].value+"_special_price").value;
  price="<span class='oldprice'>"+price+"</span><br/>"+specialprice;
 }
}
document.getElementById(target_id).firstChild.innerHTML = price;
if(j==2){stock_loc="variation_"+product_id+"_"+document.getElementById(form_id).elements[variation_name_1].value+"_"+document.getElementById(form_id).elements[variation_name_2].value+"_stock";}
else
 if(j==1){stock_loc="variation_"+product_id+"_"+document.getElementById(form_id).elements[variation_name].value+"_stock";}
var is_limited_stock = document.getElementById(form_id).elements["limited_stock_"+product_id].value;
var stock = document.getElementById(form_id).elements[stock_loc].value;
if(j>0 && is_limited_stock=="1"){
 if(stock==0) {
  document.getElementById("limited_stock_info_"+product_id).firstChild.innerHTML = "Stok untuk variasi ini habis";
 }else{
  document.getElementById("limited_stock_info_"+product_id).firstChild.innerHTML = "";
 } 
}
var resellerprice_id = "reseller_price_"+product_id;
if(j==2){resellerprice_loc="variation_"+product_id+"_"+document.getElementById(form_id).elements[variation_name_1].value+"_"+document.getElementById(form_id).elements[variation_name_2].value+"_resellerprice";
}else if(j==1){resellerprice_loc="variation_"+product_id+"_"+document.getElementById(form_id).elements[variation_name].value+"_resellerprice";
}
document.getElementById(resellerprice_id).firstChild.innerHTML = document.getElementById(resellerprice_loc).value;
resellerpoin1_id="reseller_poin1_"+product_id;
if(j==2){resellerpoin1_loc="variation_"+product_id+"_"+document.getElementById(form_id).elements[variation_name_1].value+"_"+document.getElementById(form_id).elements[variation_name_2].value+"_resellerpoin1";
}else if(j==1){resellerpoin1_loc="variation_"+product_id+"_"+document.getElementById(form_id).elements[variation_name].value+"_resellerpoin1";
}
document.getElementById(resellerpoin1_id).firstChild.innerHTML = document.getElementById(resellerpoin1_loc).value;
resellerpoin2_id="reseller_poin2_"+product_id;
if(j==2){resellerpoin2_loc="variation_"+product_id+"_"+document.getElementById(form_id).elements[variation_name_1].value+"_"+document.getElementById(form_id).elements[variation_name_2].value+"_resellerpoin2";
}else if(j==1){resellerpoin2_loc="variation_"+product_id+"_"+document.getElementById(form_id).elements[variation_name].value+"_resellerpoin2";
}
document.getElementById(resellerpoin2_id).firstChild.innerHTML = document.getElementById(resellerpoin2_loc).value;
resellerpoin3_id="reseller_poin3_"+product_id;
if(j==2){resellerpoin3_loc="variation_"+product_id+"_"+document.getElementById(form_id).elements[variation_name_3].value+"_"+document.getElementById(form_id).elements[variation_name_2].value+"_resellerpoin3";
}else if(j==1){resellerpoin3_loc="variation_"+product_id+"_"+document.getElementById(form_id).elements[variation_name].value+"_resellerpoin3";
}
document.getElementById(resellerpoin3_id).firstChild.innerHTML = document.getElementById(resellerpoin3_loc).value;
}}}
ajax.post("index.php",return_price,"ajax=true&get_updated_price=true&product_id="+product_id+value_ids);}
function shopping_cart_collapser(){switch(jQuery("#sliding_cart").css("display")){case'none':jQuery("#sliding_cart").slideToggle("fast",function(){ajax.post("index.php",noresults,"ajax=true&set_slider=true&state=1");jQuery("#fancy_collapser").attr("src",(MTOC_URL+"/images/minus.png"));});break;default:jQuery("#sliding_cart").slideToggle("fast",function(){ajax.post("index.php",noresults,"ajax=true&set_slider=true&state=0");jQuery("#fancy_collapser").attr("src",(MTOC_URL+"/images/plus.png"));});break;}
return false;}
function show_details_box(id,image_id){state=document.getElementById(id).style.display;if(state!='block'){document.getElementById(id).style.display='block';document.getElementById(image_id).src=MTOC_URL+"/images/icon_window_collapse.gif";}else{document.getElementById(id).style.display='none';document.getElementById(image_id).src=MTOC_URL+"/images/icon_window_expand.gif";}
return false;}
var register_results=function(results){jQuery("div#TB_ajaxContent").html(results);jQuery('div#checkout_login_box').css("border",'1px solid #339933');jQuery('div#checkout_login_box').css("background-color",'#e8fcea');}
function submit_register_form(frm)
{jQuery('img#register_loading_img').css("display",'inline');ajax.post("index.php?ajax=true&action=register",register_results,ajax.serialize(frm));return false;}
var fadeInSuggestion=function(suggestionBox,suggestionIframe){$(suggestionBox).fadeTo(300,1);};var fadeOutSuggestion=function(suggestionBox,suggestionIframe){$(suggestionBox).fadeTo(300,0);};function change_pics(command){location1=window.location.href;if(command==1){document.getElementById('out_view_type').innerHTML="<input type='hidden' id='view_type' name='view_type' value='default'>";document.getElementById('out_default_pic').innerHTML="<img id='default_pic' src='"+MTOC_URL+"/images/default-on.gif'>";document.getElementById('out_grid_pic').innerHTML="<img id='grid_pic' style='cursor:pointer;' onclick='change_pics(0)' src='"+MTOC_URL+"/images/grid-off.gif'>";if(location1.search(/view_type/)!=-1){$new_location=location1.replace("grid","default");}else{if(location1.search(/\?/)!=-1){$new_location=location1+"&view_type=default";}else{$new_location=location1+"?view_type=default";}}
window.location=$new_location;}else{document.getElementById('out_view_type').innerHTML="<input type='hidden' id='view_type' name='view_type' value='grid'>";document.getElementById('out_default_pic').innerHTML="<img id='default_pic'  style='cursor:pointer;' onclick='change_pics(1)' src='"+MTOC_URL+"/images/default-off.gif'>";document.getElementById('out_grid_pic').innerHTML="<img id='grid_pic' src='"+MTOC_URL+"/images/grid-on.gif'>";if(location1.search(/view_type/)!=-1){$new_location=location1.replace("default","grid");}else{if(location1.search(/\?/)!=-1){$new_location=location1+"&view_type=grid";}else{$new_location=location1+"?view_type=grid";}}
window.location=$new_location;}}
function log_buynow(form){id=form.product_id.value;price=form.item_price_1.value;ajax.post("index.php",noresults,"ajax=true&buynow=true&product_id="+id+"price="+price);}
function gotoexternallink(link){window.location=link;}
function manage_extras(product_id,extras_id,special){value_ids='';special_prefix="";extra_idss='';document.getElementById('extras_indicator'+product_id+extras_id).style.display='block';if(special==true){form_id="specials_"+product_id;}else{form_id="product_"+product_id;}
jQuery(document).ready(function(){extra_ids=jQuery("input.extras_"+product_id+":checked");});jQuery.each(extra_ids,function(key,value){extra_idss+="&extra[]="+extra_ids[key].value;});pm='stay';if(special==true){var return_price=function(results){eval(results);if(product_id!=null){target_id="special_product_price_"+product_id;buynow_id="BB_BuyButtonForm"+product_id;document.getElementById(target_id).firstChild.innerHTML=price;if(price.substring(27,price.indexOf("&"))!='')
document.getElementById(buynow_id).item_price_1.value=price.substring(27,price.indexOf("&"));}
document.getElementById('extras_indicator'+product_id+extras_id).style.display='none';}}else{var return_price=function(results){eval(results);if(product_id!=null){target_id="product_price_"+product_id;buynow_id="BB_BuyButtonForm"+product_id;document.getElementById(target_id).firstChild.innerHTML=price;if(price.substring(27,price.indexOf("&"))!='')
document.getElementById(form_id).item_price_1.value=price.substring(27,price.indexOf("&"));}
document.getElementById('extras_indicator'+product_id+extras_id).style.display='none';}}
ajax.post("index.php",return_price,"ajax=true&get_updated_price=true&pm="+pm+"&product_id="+product_id+extra_idss);}
function store_list(){address=document.getElementById('user_address').value;city=document.getElementById('user_city').value;if((address!='')&&(city!='')){document.getElementById('gloc_loading').style.display='block';ajax.post("index.php",return_store_list,"ajax=true&store_list=true&addr="+address+"&city="+city);}}
var return_store_list=function(results){document.getElementById('gloc_storelist').innerHTML=results;document.getElementById('gloc_loading').style.display='none';return true;}
function autocomplete(event){if(!event){event=window.event;}
if(event.keyCode){keyPressed=event.keyCode;}else if(event.which){keyPressed=event.which;}
str=document.getElementById('wpsc_search_autocomplete').value;if(str!=''){ajax.post("index.php",autocomplete_results,"wpsc_live_search=true&keyword="+str);}else{jQuery('#blind_down').slideUp(100);}}
var autocomplete_results=function(results){document.getElementById('blind_down').innerHTML=results;if(document.getElementById('blind_down').style.display!='block'){jQuery('#blind_down').slideDown(200);}
return true;}
function statusTextKeyPress(event){if(!event){event=window.event;}
if(event.keyCode){keyPressed=event.keyCode;}else if(event.which){keyPressed=event.which;}
if(keyPressed==9){return false;}
if(keyPressed==13){newstatus=document.getElementById('status_change_text').value;ajax.post("index.php",submit_user_status,"ajax=true&submitstatus=true&status="+newstatus);return false;}
if(keyPressed==27){document.getElementById('edit_status_select').style.display='none';return false;}
return true;}
function switchmethod(key){total=document.getElementById("shopping_cart_total_price").value;ajax.post("index.php",usps_method_switch,"ajax=true&uspsswitch=true&key="+key+"&total="+total);}
var usps_method_switch=function(results){document.getElementById("checkout_total").innerHTML=results;}

