/*/JS/Global/Resources.js*/

var Resources={init:function(){$$("script").each(function(tag){if(tag.src)Resources._registeredFiles.push(tag.src);});$$("link").each(function(tag){if(tag.href)Resources._registeredFiles.push(tag.href);});},_registeredFiles:[],_alreadyRegistered:function(url){if(Resources._registeredFiles.contains(url))return true;for(var i=0;i<Resources._registeredFiles.length;i++){var s=Resources._registeredFiles[i];if(s.indexOf("http://")==0&&s.indexOf(url)==s.length-url.length)return true;}
return false;},RegisterCssFile:function(href){if(Resources._alreadyRegistered(href))return;Resources._registeredFiles.push(href);Asset.css(href);},RegisterJsFile:function(src){if(Resources._alreadyRegistered(src))return;Resources._registeredFiles.push(src);Asset.javascript(src);}};$DL(Resources.init,1);

/*/JS/Global/WebService.js*/

var WebService=new Class({Implements:[Chain,Options,Events],request:null,initialize:function(options){this.setOptions(options);},send:function(methodName,data,onSuccess,onFailure){this.request=new Request.JSON({url:this.url+"/"+methodName,onSuccess:onSuccess,onFailure:function(ex){var error=eval("("+ex.responseText+")").Message;if(onFailure)onFailure(error);else alert(error);}.bind(this),data:JSON.encode(data||{}),urlEncoded:false});this.request.headers.erase("Accept").erase("X-Request").extend({"Content-Type":"application/json; charset=utf-8"});WebService.fireEvent("onSending",[this.request,methodName]);this.fireEvent("onSending",[this.request,methodName]);this.request.send();this.fireEvent("onSent",[this.request,methodName]);WebService.fireEvent("onSent",[this.request,methodName]);return this;},abort:function(){if(this.request)this.request.cancel();return this;}});Events.makeObjectEventable(WebService);$DL(function(){WebService.AuthenticationServiceClass=new Class({Extends:WebService,url:Config.RootUrl+"Authentication_JSON_AppService.axd",login:function(userName,password,createPersistentCookie,onSuccess,onFailure){return WebService.prototype.send.apply(WebService.AuthenticationService,["Login",{userName:userName,password:password,createPersistentCookie:createPersistentCookie},onSuccess,onFailure]);},logout:function(redirectUrl,onSuccess,onFailure){return WebService.prototype.send.apply(WebService.AuthenticationService,["Logout",null,onSuccess?onSuccess.bind(null,[redirectUrl]):function(redirectUrl){location.href=redirectUrl||location.href;},onFailure]);}});WebService.AuthenticationService=new WebService.AuthenticationServiceClass();WebService.ProfileServiceClass=new Class({Extends:WebService,url:Config.RootUrl+"Profile_JSON_AppService.axd",properties:new Hash(),save:function(propertyNamesToSave,onSuccess,onFailure){var propertiesWithValues={};propertyNamesToSave.each(function(name){propertiesWithValues[name]=this.properties[name];},this);return WebService.prototype.send.apply(WebService.ProfileService,["SetPropertiesForCurrentUser",{values:propertiesWithValues,authenticatedUserOnly:false},onSuccess,onFailure]);},load:function(propertyNamesToLoad,onSuccess,onFailure){var methodName,args=new Hash();if(!propertyNamesToLoad){methodName="GetAllPropertiesForCurrentUser";}else{methodName="GetPropertiesForCurrentUser";propertyNamesToLoad.removeDuplicates();args.extend({properties:propertyNamesToLoad});}
args.extend({authenticatedUserOnly:false});return WebService.prototype.send.apply(WebService.ProfileService,[methodName,args,function(result){Hash.each(result,function(value,key){this.properties[key]=value;},this);if(onSuccess)onSuccess(result);}.bind(this),onFailure]);}});WebService.ProfileService=new WebService.ProfileServiceClass();},2);

/*/JS/Global/Config.js*/

var Config={};

/*/JS/Site/Site.js*/

var Loader=new Hash({init:function(){if($("page"))
Loader.element=$("page").getElement(".loader");},show:function(pos){if(pos)Loader.element.set('styles',{'top':pos.top,'left':pos.left});Loader.element.show();Loader.fireEvent("onAfterShow");},hide:function(){Loader.element.set('styles',{'top':175,'left':450});Loader.element.hide();Loader.fireEvent("onAfterHide");}});Events.makeObjectEventable(Loader);var Site=new Hash({numOfBrands:null,brandsLineFx:null,brandLogos:null,brandsLayerFx:null,brandsPagingFxStatus:0,init:function(){Site._initTopMenu();if($("header")&&$("header").getElement(".caseNum"))
Site._initCase();},_initTopMenu:function(){if($("header")&&$("header").getElement(".brandsLi")){var brandsLink=$("header").getElement(".brandsLi");var brandsLine=$("header").getElement(".brandsLine");var brandsLayer=$("header").getElement(".fullBrandsLine").getElement(".brands");Site.brandLogos=$("header").getElements(".brand");var brandsPagerArrows=brandsLine.getElement(".arrows");var arrowLeft=brandsPagerArrows.getElement(".arrowLeft");var arrowRight=brandsPagerArrows.getElement(".arrowRight");var caseUrl=$("header").getElement(".caseTop");var caseTT=$("header").getElement(".caseTT");var topLinks=$("header").getElements(".menuItem");Site.brandsLineFx=new Fx.Tween(brandsLine,{wait:false,duration:180});if(caseUrl){caseUrl.addEvent('mouseenter',function(e){if($("header")&&$("header").getElement(".caseNum").innerHTML=="")
caseTT.setStyle("display","block")});caseUrl.addEvent('mouseleave',function(e){caseTT.setStyle("display","none")});caseTT.setStyle("left",caseUrl.getPosition($("header"))['x'].toInt()+5);}
brandsLine.setStyle("left",brandsLink.getPosition($("header"))['x'].toInt()-60);var fxObj={};brandsLink.addEvent('mouseenter',function(e){Site.brandsLineFx.start('height',40);});[arrowLeft,arrowRight].each(function(arrow){arrow.addEvent('click',function(e){e=new Event(e);e.stop();if(Site.brandsPagingFxStatus==1)return;var tempEl=(arrow==arrowLeft)?($("header").getElements(".brand")[$("header").getElements(".brand").length-1].clone(true,true)):($("header").getElements(".brand")[0].clone(true,true));var tempwidth=$("header").getElements(".brand")[$("header").getElements(".brand").length-1].getWidth().toInt();tempEl.setStyles({"width":0,"padding-left":4,"padding-right":4});switch(arrow){case arrowLeft:tempEl.inject($("header").getElements(".brand")[0],'before');break;case arrowRight:tempEl.inject($("header").getElements(".brand")[$("header").getElements(".brand").length-1],'after');break;}
var morphFxIndex=(arrow==arrowLeft)?(1):(2);Site._scrollBrands(tempwidth,$("header").getElements(".brand")[$("header").getElements(".brand").length-1],$("header").getElements(".brand")[0],morphFxIndex);});});brandsLink.addEvent('mouseleave',function(e){fxObj[0]={'height':0};if(!((e.client.y<(brandsLine.getPosition()['y'].toInt())+24)&&(e.client.y>(brandsLine.getPosition()['y'].toInt())-15)&&(e.client.x<(brandsLine.getPosition()['x'].toInt())+174)&&(e.client.x>(brandsLine.getPosition()['x'].toInt()))))
Site.brandsLineFx.start(fxObj);});brandsLine.addEvent('mouseleave',function(e){fxObj[0]={'height':0};if(!((e.client.y<(brandsLine.getPosition()['y'].toInt())+24)&&(e.client.y>(brandsLine.getPosition()['y'].toInt())-15)&&(e.client.x<(brandsLine.getPosition()['x'].toInt())+174)&&(e.client.x>(brandsLine.getPosition()['x'].toInt()))))
Site.brandsLineFx.start('height',0);});$("header").addEvent('mouseenter',function(e){Site.brandsLineFx.start('height',0);});brandsLine.addEvent('mouseenter',function(e){$("header").getElement(".brandsLi").addClass("hover");});brandsLine.addEvent('mouseleave',function(e){$("header").getElement(".brandsLi").removeClass("hover");});Site.brandLogos.each(function(item,i){item.addEvent('click',function(e){Gallery._openSuperBrand(item.id.substring(2));});});}
$$(".topMenu .menuItem").addEvent('mouseenter',function(e){this.addClass("hover");});$$(".topMenu .menuItem").addEvent('mouseleave',function(){this.removeClass("hover");});},_initLightbox:function(){if(typeof(Lightbox)!="undefined")Lightbox.setOptions({backgroundColor:"#000000",opacity:0.4,containerClass:"lightbox",offsetTop:300});},_scrollBrands:function(tempWidth,elToDispose,elToEnlarge,morphFxIndex){Site.brandsPagingFxStatus=1;var obj={"width":(morphFxIndex==1)?(0):(tempWidth),"padding-left":0,"padding-right":0};var morph1=new Fx.Morph((morphFxIndex==1)?(elToDispose):(elToDispose),{duration:(morphFxIndex==1)?(0):(0),transition:Fx.Transitions.Cubic.easeOut,link:'ignore'}).start(obj).chain(function(){obj={"width":(morphFxIndex==1)?(tempWidth):(0),"padding-left":0,"padding-right":0};var morph2=new Fx.Morph((morphFxIndex==1)?(elToEnlarge):(elToEnlarge),{duration:(morphFxIndex==1)?(600):(600),transition:Fx.Transitions.Cubic.easeOut,link:'ignore'}).start(obj).chain(function(){if(morphFxIndex==1)
elToDispose.dispose();else
elToEnlarge.dispose();Site.brandsPagingFxStatus=0;});});},_initDotNetValidatorFunctions:function(){if(typeof(ValidatorUpdateDisplay)=="function")eval("window.ValidatorUpdateDisplay="+
ValidatorUpdateDisplay.toString().replace("ValidatorUpdateDisplay","").replace(/inline/g,"block"));if(typeof(ValidationSummaryOnSubmit)=="function")eval("window.ValidationSummaryOnSubmit="+
ValidationSummaryOnSubmit.toString().replace("ValidationSummaryOnSubmit","").replace(/window.scrollTo\(0,0\);/,""));},_initCase:function(){var caseNum=$("header").getElement(".caseNum");Mantis.ModyCeramics.Services.GalleryService.GetCaseNum(function(num){if(num>0){caseNum.setStyle("display","");caseNum.innerHTML="("+num+")";}
else
caseNum.setStyle("display","none");});},_getCaseGallery:function(){var caseNum=$("header").getElement(".caseNum");Mantis.ModyCeramics.Services.GalleryService.GetCaseNum(function(num){if(num>0){location.href="Gallery.aspx?cat=99999";}
else{return false;}});}});$DL(function(){Site.init();Loader.init();});

