
function SetCookie(name,value,expires,path,domain,secure){var exp_date=new Date(expires);var cur_cookie=name+"="+escape(value)+
((expires)?"; expires="+exp_date.toGMTString():"")+
((path)?"; path="+path:"")+
((domain)?"; domain="+domain:"")+
((secure)?"; secure":"");document.cookie=cur_cookie;}
function GetCookie(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)
return null;}else
begin+=2;var end=dc.indexOf(";",begin);if(end==-1)
end=dc.length;return unescape(dc.substring(begin+prefix.length,end));}
function DeleteCookie(name,path,domain){if(GetCookie(name))
document.cookie=name+"="+"; expires=Thu, 01-Jan-70 00:00:01 GMT"+
((path)?"; path="+path:"")+
((domain)?"; domain="+domain:"");}


var TOOLTIP_LAYER_NAME='TooltipLayer';var HIDE_TOOLTIP_LAYER_TIMEOUT=1000*60;var TOOLTIP_LAYER_OFFSET=10;var TOOLTIP_LAYER_WIDTH=257;var TOOLTIP_LAYER_HEIGHT=50;var TOOLTIP_LAYER_CORNER_WIDTH=7;var TOOLTIP_LAYER_CORNER_HEIGHT=7;var tooltip_timer_handle=null;var _TOOLTIP_IS_ALREADY_SHOWN=false;var _LAST_SHOWN_TOOLTIP_KEY="";var _TOOLTIP_GLOBAL_LOCK=false;var _CURRENT_TOOLTIP_OBJ=null;var _CURRENT_TOOLTIP_WIDTH='';var _CURRENT_TOOLTIP_HEIGHT='';var _CURRENT_TOOLTIP_TOP_OFFSET='';var _CURRENT_TOOLTIP_LEFT_OFFSET='';function ShowTooltip(obj,key,_width,_height,_top_offset,_left_offset,fixed_left_position,fixed_top_postion)
{if(typeof(obj)=='undefined'||typeof(TOOLTIPS)=='undefined'||typeof(TOOLTIPS[key])=='undefined')
return;if(typeof(_top_offset)=='undefined'||_top_offset==''){_top_offset=0;}
if(typeof(_left_offset)=='undefined'||_left_offset==''){_left_offset=0;}
if(_TOOLTIP_GLOBAL_LOCK){_CURRENT_TOOLTIP_OBJ=obj;_CURRENT_TOOLTIP_WIDTH=_width;_CURRENT_TOOLTIP_HEIGH=_height;_CURRENT_TOOLTIP_TOP_OFFSET=_top_offset;_CURRENT_TOOLTIP_LEFT_OFFSET=_left_offset;var str="ShowTooltip( _CURRENT_TOOLTIP_OBJ, '"+key+"', _CURRENT_TOOLTIP_WIDTH, _CURRENT_TOOLTIP_HEIGHT, _CURRENT_TOOLTIP_TOP_OFFSET, _CURRENT_TOOLTIP_LEFT_OFFSET );";window.setTimeout(str,10);return;}
var top_offset=_top_offset;var left_offset=_left_offset;var layer=new Layer(TOOLTIP_LAYER_NAME);var width=typeof(_width)=='undefined'||!_width?TOOLTIP_LAYER_WIDTH:_width;var height=typeof(_height)=='undefined'||!_height?TOOLTIP_LAYER_HEIGHT:_height;layer.SetVisible(false);if(tooltip_timer_handle){window.clearTimeout(tooltip_timer_handle);tooltip_timer_handle=null;}
if(!layer)return;var tooltip=TOOLTIPS[key];if(typeof(NO_ESCAPE[key])=='undefined'||!NO_ESCAPE[key]){tooltip=tooltip.replace(/&/g,"&amp;");tooltip=tooltip.replace(/\"/g,"&#34;");tooltip=tooltip.replace(/</g,"&lt;");tooltip=tooltip.replace(/>/g,"&gt;");}
tooltip=tooltip.replace(/\r/g,"");tooltip=tooltip.replace(/\n/g,"<br>");var tooltip_html='<table cellspacing=0 cellpadding=0 border=0 width=100%>'+'<tr><td width=2><img src="'+SPACE+'" width=3 height=1></td>'+'<td class=tooltip width=99%>'+tooltip+'</td>'+'<td width=2><img src="'+SPACE+'" width=2 height=1></td>'+'<td valign=top><a onclick="javascript:HideTooltip( )">'+'<img src="'+TOOLTIP_CLOSE+'" border=0 width=13 height=13></a></td></tr>'+'<tr><td width=2 colspan=4><img src="'+SPACE+'" width=1 height=2></td></tr>'+'</table>';var code='<table cellspacing=0 cellpadding=0 border=0 width='+width+'>'+'<tr>'+'<td width='+TOOLTIP_LAYER_CORNER_WIDTH+' height='+TOOLTIP_LAYER_CORNER_HEIGHT+'>'+'<img src="'+TOOLTIP_TOP_LEFT+'" width='+TOOLTIP_LAYER_CORNER_WIDTH+' height='+TOOLTIP_LAYER_CORNER_HEIGHT+'>'+'</td>'+'<td class=tooltip width='+(width-2*TOOLTIP_LAYER_CORNER_WIDTH)+' ><img src="'+SPACE+'" width='+width+' height=7></td>'+'<td width='+TOOLTIP_LAYER_CORNER_WIDTH+' height='+TOOLTIP_LAYER_CORNER_HEIGHT+'>'+'<img src="'+TOOLTIP_TOP_RIGHT+'" width='+TOOLTIP_LAYER_CORNER_WIDTH+' height='+TOOLTIP_LAYER_CORNER_HEIGHT+'>'+'</td>'+'</tr>'+'<tr>'+'<td width='+TOOLTIP_LAYER_CORNER_WIDTH+' class=tooltip><img src="'+SPACE+'" width='+TOOLTIP_LAYER_CORNER_WIDTH+' height=7></td>'+'<td class=tooltip>'+tooltip_html+'</td>'+'<td width='+TOOLTIP_LAYER_CORNER_WIDTH+' class=tooltip><img src="'+SPACE+'" width='+TOOLTIP_LAYER_CORNER_WIDTH+' height=7></td>'+'</tr>'+'<tr>'+'<td width='+TOOLTIP_LAYER_CORNER_WIDTH+' height='+TOOLTIP_LAYER_CORNER_HEIGHT+'>'+'<img src="'+TOOLTIP_BOTTOM_LEFT+'" width='+TOOLTIP_LAYER_CORNER_WIDTH+' height='+TOOLTIP_LAYER_CORNER_HEIGHT+'>'+'</td>'+'<td class=tooltip width='+(width-2*TOOLTIP_LAYER_CORNER_WIDTH)+' ><img src="'+SPACE+'" width='+width+' height=7></td>'+'<td width='+TOOLTIP_LAYER_CORNER_WIDTH+' height='+TOOLTIP_LAYER_CORNER_HEIGHT+'>'+'<img src="'+TOOLTIP_BOTTOM_RIGHT+'" width='+TOOLTIP_LAYER_CORNER_WIDTH+' height='+TOOLTIP_LAYER_CORNER_HEIGHT+'>'+'</td>'+'</tr>'+'</table>';layer.SetDimentions(width,height);layer.HTML(code);var left=0;var top=0;if(obj!=null){if(!document.getElementById){left=window.pageXOffset;top=window.pageYOffset;}else{var obj_position=GetObjectAbsolutePosition(obj);if(!document.all){left=obj_position.left+obj.offsetWidth+TOOLTIP_LAYER_OFFSET;top=obj_position.top-obj.offsetHeight;}else{left=obj_position.left+obj.clientWidth+TOOLTIP_LAYER_OFFSET;top=obj_position.top-obj.clientHeight;}}}
if(fixed_left_position){left=fixed_left_position;}
if(fixed_top_postion){top=fixed_top_postion;}
if(left+width>layer.DocumentWidth){left=layer.DocumentWidth-width;}
if(left<0){left=0;}
layer.SetPosition(left+left_offset,top+top_offset);layer.SetDisplay(true);layer.SetVisible(true);_TOOLTIP_IS_ALREADY_SHOWN=true;_LAST_SHOWN_TOOLTIP_KEY=key;tooltip_timer_handle=window.setTimeout('HideTooltip();',HIDE_TOOLTIP_LAYER_TIMEOUT);}
function HideTooltip()
{_TOOLTIP_GLOBAL_LOCK=true;window.setTimeout('var l=new Layer( TOOLTIP_LAYER_NAME );l.SetVisible( false );l.SetDisplay( false );_TOOLTIP_GLOBAL_LOCK=false;',100);if(tooltip_timer_handle)
window.clearTimeout(tooltip_timer_handle);tooltip_timer_handle=false;_TOOLTIP_IS_ALREADY_SHOWN=false;}
function GetObjectAbsolutePosition(obj)
{var pos=new Object();pos.left=0;pos.top=0;if(!obj||typeof(obj)=='undefined'||typeof(obj.offsetLeft)=='undefined')
return pos;if(obj.nodeName!="DIV"&&obj.nodeName!="TR"&&obj.nodeName!="CENTER"&&obj.nodeName!="P"){pos.left=obj.offsetLeft;pos.top=obj.offsetTop;}
var parent_pos=GetObjectAbsolutePosition(obj.parentNode);if(obj.parentNode&&typeof(obj.parentNode)!='undefined'&&typeof(obj.parentNode.children)!='undefined'){for(var i=0;i<obj.parentNode.children.length;i++){if(obj.parentNode.children.sourceIndex>=obj.sourceIndex)
break;if(obj.parentNode.children[i].nodeName=="IMG"&&i==0&&obj.parentNode.nodeName!="TD")
pos.top+=obj.parentNode.children[i].offsetTop;}}
pos.left+=parent_pos.left;pos.top+=parent_pos.top;return pos;}
function SetHinderingObjectsVisibility(how)
{if(document.all){for(var i=0;i<document.forms.length;i++){for(var j=0;j<document.forms[i].elements.length;j++){if(document.forms[i].elements[j].nodeName.toUpperCase()=='SELECT'||document.forms[i].elements[j].nodeName.toUpperCase()=='IFRAME'){document.forms[i].elements[j].style.display=how?"block":"none";}}}}}
function AddTooltip(key,value)
{TOOLTIPS[key]=value;}


var TOOLTIPS=new Array();var NO_ESCAPE=new Array();TOOLTIPS['NavMenuItem__Text']='If you choose from Link [Create new page] this text will be a Page Name';TOOLTIPS['NavMenuItem__Alt']='If you choose from Link [Create new page] this MouseOver text will be a Page Title';TOOLTIPS['File__Src']='The time to upload may vary depending on the speed of your internet connection. Uploding files over 100Mb is not recommened.';TOOLTIPS['GalleryImageZip__Src']='You can upload a single image (JPG, GIF, PNG) or a ZIP file with many images in it. The time to upload may vary depending on the speed of your internet connection. Uploding files over 100Mb is not recommened.';TOOLTIPS['GalleryKeepImage__Chk']='If checked, site visitors will be able to see the images in their original resolution. However, keeping the original image requires significantly more storage space.';TOOLTIPS['MailingList__Name']='Your mailing list will appear with this name in the Mailing Lists Management';TOOLTIPS['MailingList__Prefix']='The text will be displayed in front of the mailing list subscription field';TOOLTIPS['MailingList__ButtonLabel']='The text will be displayed on the subscription button';TOOLTIPS['MailingList__RequiresConfirmation']='If this option is enabled users will be asked by email to confirm subscription';TOOLTIPS['MailingListAA__AppendUnsubscrURL']='A link for unsubscribing will be added automatically to your email';TOOLTIPS['SiteProperties__Keywords']="Site keywords";TOOLTIPS['SiteProperties__Description']="Site description";TOOLTIPS['SiteProperties__SiteTitle']="Your site title";TOOLTIPS['SiteProperties__PageTitleDelimiter']="Page Delimiter (separates Site and Page Titles in the browser titlebar (e.g. Site - Page)";TOOLTIPS['SiteProperties__NewsPerPage']="If you have a news group added to your site, specify how many news items you need displayed at once. If the number of all your news items is bigger than the number of news per page, all other news items will appear when you click 'Prev' and 'Next' navigation available above and below your news group.";


function Affiliates(url_params)
{this.SetAffiliate=function(){var loc=window.location;var domain=loc.hostname;var ref_domain="";if(document.referrer!=""){var ref=document.referrer;var start=ref.indexOf("://");if(start!=-1){start+=3;var end=ref.indexOf("/",start);ref_domain=ref.substr(start,end-start);}}
var affiliate_ref=url_params.affiliate_referrer_id;var package_code=url_params.package_code;var http_ref=url_params.http_referrer_id;if(typeof redirection_done=='undefined'||!redirection_done){var form=document.SignUpForm;if(form){var extra_fields={affiliate_referrer_id:{value:affiliate_ref,name:'Wizard__AffiliateReferrer'},http_referrer_id:{value:http_ref,name:'Wizard__HttpReferrer'},package_code:{value:package_code,name:'Wizard__PackageCode'}};for(var field_type in extra_fields){if(typeof extra_fields[field_type].value!='undefined'&&extra_fields[field_type].value!=''){new Element('input',{"type":"hidden","name":extra_fields[field_type].name,"value":extra_fields[field_type].value}).inject(form);}}}}}}


SK.Peripherials=function(){this.mouse_pos={x:0,y:0};this.init=function(){var self=this;var f_mm=function(e){self.mouse_pos={x:e.page.x,y:e.page.y};};var f_md=function(e){self.mouse_pos={x:e.page.x,y:e.page.y};}
$(document.body).addEvent('mousemove',f_mm);$(document.body).addEvent('mousedown',f_md);}
this.getMousePosition=function(){return this.mouse_pos;}}


SK.UI.Progress=function(options){this.ie6=document.all&&navigator.appVersion.indexOf("MSIE 6")!=-1?true:false;this.ie7=document.all&&navigator.appVersion.indexOf("MSIE 7")!=-1?true:false;this.ff2=navigator.userAgent.toLowerCase().indexOf("firefox/2")!=-1?true:false;this.ff1=navigator.userAgent.toLowerCase().indexOf("firefox/1")!=-1?true:false;this.mac=navigator.userAgent.toLowerCase().indexOf("macintosh")!=-1?true:false;this.ff2mac=this.ff2&&this.mac;this.ff1mac=this.ff1&&this.mac;this.safari=navigator.appVersion.indexOf("Safari")!=-1?true:false;this.ANIMATION_INTERVAL=60;this.ANIMATION_STEPS=24;this.FRAME_HEIGHT=60;this.WRAPPER_OPACITY=1.0;this.BG_OPACITY=0.7;this.options={};if(typeof options!='undefined')this.options=options;if(typeof this.options.callbacks=='undefined'){this.options.callbacks={};}
if(typeof this.options.placeholder=='undefined'){this.options.placeholder=$(document);}
this.disturbing_elements=[];this.init=function(message){this.create();this.reset();this.message=message;var self=this;window.addEvent('scroll',function(){self.center();});window.addEvent('resize',function(){self.center();});}
this.create=function(){if(this.options.zindex){$('progress_ui_wrapper').setStyles({'z-index':this.options.zindex});}}
this.destroy=function(){if(this.options.zindex)
$('progress_ui_wrapper').setStyles({'z-index':''});}
this.reset=function(){this.disturbing_elements=[];}
this.display=function(){this.collectDisturbingElements();this.hideDisturbingElements();this.center();this.displayContents();}
this.hide=function(){this.hideContents();this.displayDisturbingElements();this.destroy();}
this.displayContents=function(){$('progress_ui_message').innerHTML=this.message;$('progress_ui_wrapper').setStyles({'opacity':'0.0','display':'block'});var self=this;var complete_f=function(){if(self.options.callbacks.onafterdisplay){self.options.callbacks.onafterdisplay();}};var wrapper_opacity=this.WRAPPER_OPACITY;var bg_opacity=this.BG_OPACITY;if(this.options.duration==0){$('progress_ui_wrapper').setStyle('opacity',wrapper_opacity);$('progress_ui_background').setStyle('opacity',bg_opacity);complete_f();}else{var anim=new Fx.Morph('progress_ui_wrapper',{duration:this.options.duration?this.options.duration:200,transition:Fx.Transitions.Sine.easeOut,onComplete:complete_f});anim.start({opacity:wrapper_opacity});$('progress_ui_background').setStyles({'opacity':'0.0','display':'block'});var self=this;var anim=new Fx.Morph('progress_ui_background',{duration:this.options.duration?this.options.duration:200,transition:Fx.Transitions.Sine.easeOut});anim.start({opacity:bg_opacity});}
this.startImagesAnimation();}
this.startImagesAnimation=function(){var self=this;$('skwaiting_stripe').setStyle('display','block');var frame_id=1;this.images_animation_timer=window.setInterval(function(){self.displayImagesAnimationFrame(frame_id++);if(frame_id>self.ANIMATION_STEPS){frame_id=1;}},this.ANIMATION_INTERVAL);}
this.displayImagesAnimationFrame=function(frame_id){var top=-(frame_id-1)*this.FRAME_HEIGHT;$('skwaiting_stripe').setStyle('top',top);}
this.stopImagesAnimation=function(){window.clearTimeout(this.images_animation_timer);}
this.hideContents=function(){$('progress_ui_wrapper').setStyle('display','none');this.stopImagesAnimation();}
this.isFullOfBugsIE=function(){return((document.compatMode=='BackCompat'&&Browser.Engine.trident)||(document.compatMode!='BackCompat'&&Browser.Engine.trident4==true));}
this.center=function(){var p=$(this.options.placeholder);var size=p.getSize();var scroll=p.getScroll();var pos=p.getCoordinates();if(this.isFullOfBugsIE()){$('progress_ui_wrapper').setStyles({'left':scroll.x+pos.left,'top':scroll.y+pos.top});}else{var position=!p.get||p.get('tag').toLowerCase()=='body'?'fixed':p.getStyle('position')=='fixed'?'fixed':'absolute';$('progress_ui_wrapper').setStyles({'position':position,'left':0+pos.left,'top':0+pos.top});}
var objs=['progress_ui_wrapper','progress_ui_background','progress_ui_foreground','progress_ui_content'];for(var i=0;i<objs.length;i++){$(objs[i]).setStyle('width',size.x);$(objs[i]).setStyle('height',size.y);}}
this.hideDisturbingElements=function(){for(var i=0;i<this.disturbing_elements.length;i++){if($(this.disturbing_elements[i])&&$(this.disturbing_elements[i]).setStyle){$(this.disturbing_elements[i]).setStyle('display','none');}}}
this.displayDisturbingElements=function(){for(var i=0;i<this.disturbing_elements.length;i++){if($(this.disturbing_elements[i])&&$(this.disturbing_elements[i]).setStyle){$(this.disturbing_elements[i]).setStyle('display','');}
if(this.safari){this.patchSafariFlashElements(this.disturbing_elements[i],false);}}}
this.collectDisturbingElements=function(){var target_tags=['object','embed','param'];if(this.ie6)target_tags.push('select');for(var j=0;j<target_tags.length;j++){var objs=document.getElementsByTagName(target_tags[j]);for(var i=0;i<objs.length;i++){this.disturbing_elements.push(objs[i]);if(this.safari){this.patchSafariFlashElements(objs[i],false);}}}}
this.patchSafariFlashElements=function(e,undo){if(undo){var old_wmode=e.getAttribute('old_wmode');if(old_wmode)e.setAttribute('wmode',old_wmode);else e.removeAttribute('wmode');}else{var old_wmode=e.getAttribute('wmode');e.setAttribute('wmode','opaque');if(old_wmode)e.setAttribute('old_wmode',old_wmode);}}};


Fx.Scroll=new Class({Extends:Fx,options:{offset:{'x':0,'y':0},wheelStops:true},initialize:function(element,options){this.element=this.subject=$(element);this.parent(options);var cancel=this.cancel.bind(this,false);if($type(this.element)!='element')this.element=$(this.element.getDocument().body);var stopper=this.element;if(this.options.wheelStops){this.addEvent('start',function(){stopper.addEvent('mousewheel',cancel);},true);this.addEvent('complete',function(){stopper.removeEvent('mousewheel',cancel);},true);}},set:function(){var now=Array.flatten(arguments);this.element.scrollTo(now[0],now[1]);},compute:function(from,to,delta){var now=[];var x=2;x.times(function(i){now.push(Fx.compute(from[i],to[i],delta));});return now;},start:function(x,y){if(!this.check(arguments.callee,x,y))return this;var offsetSize=this.element.getSize(),scrollSize=this.element.getScrollSize();var scroll=this.element.getScroll(),values={x:x,y:y};for(var z in values){var max=scrollSize[z]-offsetSize[z];if($chk(values[z]))values[z]=($type(values[z])=='number')?values[z].limit(0,max):max;else values[z]=scroll[z];values[z]+=this.options.offset[z];}
return this.parent([scroll.x,scroll.y],[values.x,values.y]);},toTop:function(){return this.start(false,0);},toLeft:function(){return this.start(0,false);},toRight:function(){return this.start('right',false);},toBottom:function(){return this.start(false,'bottom');},toElement:function(el){var position=$(el).getPosition(this.element);return this.start(position.x,position.y);}});


Fx.Slide=new Class({Extends:Fx,options:{mode:'vertical'},initialize:function(element,options){this.addEvent('complete',function(){this.open=(this.wrapper['offset'+this.layout.capitalize()]!=0);if(this.open&&Browser.Engine.webkit419)this.element.dispose().inject(this.wrapper);},true);this.element=this.subject=$(element);this.parent(options);var wrapper=this.element.retrieve('wrapper');this.wrapper=wrapper||new Element('div',{styles:$extend(this.element.getStyles('margin','position'),{'overflow':'hidden'})}).wraps(this.element);this.element.store('wrapper',this.wrapper).setStyle('margin',0);this.now=[];this.open=true;},vertical:function(){this.margin='margin-top';this.layout='height';this.offset=this.element.offsetHeight;},horizontal:function(){this.margin='margin-left';this.layout='width';this.offset=this.element.offsetWidth;},set:function(now){this.element.setStyle(this.margin,now[0]);this.wrapper.setStyle(this.layout,now[1]);return this;},compute:function(from,to,delta){var now=[];var x=2;x.times(function(i){now[i]=Fx.compute(from[i],to[i],delta);});return now;},start:function(how,mode){if(!this.check(arguments.callee,how,mode))return this;this[mode||this.options.mode]();var margin=this.element.getStyle(this.margin).toInt();var layout=this.wrapper.getStyle(this.layout).toInt();var caseIn=[[margin,layout],[0,this.offset]];var caseOut=[[margin,layout],[-this.offset,0]];var start;switch(how){case'in':start=caseIn;break;case'out':start=caseOut;break;case'toggle':start=(this.wrapper['offset'+this.layout.capitalize()]==0)?caseIn:caseOut;}
return this.parent(start[0],start[1]);},slideIn:function(mode){return this.start('in',mode);},slideOut:function(mode){return this.start('out',mode);},hide:function(mode){this[mode||this.options.mode]();this.open=false;return this.set([-this.offset,0]);},show:function(mode){this[mode||this.options.mode]();this.open=true;return this.set([0,this.offset]);},toggle:function(mode){return this.start('toggle',mode);}});Element.Properties.slide={set:function(options){var slide=this.retrieve('slide');if(slide)slide.cancel();return this.eliminate('slide').store('slide:options',$extend({link:'cancel'},options));},get:function(options){if(options||!this.retrieve('slide')){if(options||!this.retrieve('slide:options'))this.set('slide',options);this.store('slide',new Fx.Slide(this,this.retrieve('slide:options')));}
return this.retrieve('slide');}};Element.implement({slide:function(how,mode){how=how||'toggle';var slide=this.get('slide'),toggle;switch(how){case'hide':slide.hide(mode);break;case'show':slide.show(mode);break;case'toggle':var flag=this.retrieve('slide:flag',slide.open);slide[(flag)?'slideOut':'slideIn'](mode);this.store('slide:flag',!flag);toggle=true;break;default:slide.start(how,mode);}
if(!toggle)this.eliminate('slide:flag');return this;}});


var Tips=new Class({Implements:[Events,Options],options:{onShow:function(tip){tip.setStyle('visibility','visible');},onHide:function(tip){tip.setStyle('visibility','hidden');},showDelay:100,hideDelay:100,className:null,offsets:{x:16,y:16},fixed:false},initialize:function(){var params=Array.link(arguments,{options:Object.type,elements:$defined});this.setOptions(params.options||null);this.tip=new Element('div').inject(document.body);if(this.options.className)this.tip.addClass(this.options.className);var top=new Element('div',{'class':'tip-top'}).inject(this.tip);this.container=new Element('div',{'class':'tip'}).inject(this.tip);var bottom=new Element('div',{'class':'tip-bottom'}).inject(this.tip);this.tip.setStyles({position:'absolute',top:0,left:0,visibility:'hidden'});if(params.elements)this.attach(params.elements);},attach:function(elements){$$(elements).each(function(element){var title=element.retrieve('tip:title',element.get('title'));var text=element.retrieve('tip:text',element.get('rel')||element.get('href'));var enter=element.retrieve('tip:enter',this.elementEnter.bindWithEvent(this,element));var leave=element.retrieve('tip:leave',this.elementLeave.bindWithEvent(this,element));element.addEvents({mouseenter:enter,mouseleave:leave});if(!this.options.fixed){var move=element.retrieve('tip:move',this.elementMove.bindWithEvent(this,element));element.addEvent('mousemove',move);}
element.store('tip:native',element.get('title'));element.erase('title');},this);return this;},detach:function(elements){$$(elements).each(function(element){element.removeEvent('mouseenter',element.retrieve('tip:enter')||$empty);element.removeEvent('mouseleave',element.retrieve('tip:leave')||$empty);element.removeEvent('mousemove',element.retrieve('tip:move')||$empty);element.eliminate('tip:enter').eliminate('tip:leave').eliminate('tip:move');var original=element.retrieve('tip:native');if(original)element.set('title',original);});return this;},elementEnter:function(event,element){$A(this.container.childNodes).each(Element.dispose);var title=element.retrieve('tip:title');if(title){this.titleElement=new Element('div',{'class':'tip-title'}).inject(this.container);this.fill(this.titleElement,title);}
var text=element.retrieve('tip:text');if(text){this.textElement=new Element('div',{'class':'tip-text'}).inject(this.container);this.fill(this.textElement,text);}
this.timer=$clear(this.timer);this.timer=this.show.delay(this.options.showDelay,this);this.position((!this.options.fixed)?event:{page:element.getPosition()});},elementLeave:function(event){$clear(this.timer);this.timer=this.hide.delay(this.options.hideDelay,this);},elementMove:function(event){this.position(event);},position:function(event){var size=window.getSize(),scroll=window.getScroll();var tip={x:this.tip.offsetWidth,y:this.tip.offsetHeight};var props={x:'left',y:'top'};for(var z in props){var pos=event.page[z]+this.options.offsets[z];if((pos+tip[z]-scroll[z])>size[z])pos=event.page[z]-this.options.offsets[z]-tip[z];this.tip.setStyle(props[z],pos);}},fill:function(element,contents){(typeof contents=='string')?element.set('html',contents):element.adopt(contents);},show:function(){this.fireEvent('show',this.tip);},hide:function(){this.fireEvent('hide',this.tip);}});


SK.UI.DesignSelectorThumbnailsUI=function(_options){var design_filter_effect;var large_view_effect;var selected_design_id=0;var zoom_design_id=0;var current_num_designs;var large_design_box=0;var large_view_y;var large_view_x;var design_config=null;var large_view_img_width=600;var large_view_img_height=450;var progress_zindex=6;var DESIGN_ID_PREFIX='design_';var ZOOM_ICON_ID_PREFIX='zoom_icon_';var THUMB_ID_PREFIX='thumb_';var COLOR_ID_PREFIX='color_';var designs=new Array();var options=!$defined(_options)?{}:_options;var user_filter=function(d){return true;}
var dropdowns_by_filter={'name':$(options.placeholders.filter_design),'color':$(options.placeholders.filter_color),'business':$(options.placeholders.filter_business),'year':$(options.placeholders.filter_year)};var fdropdown=$(options.placeholders.filter_type);var progress_ui=null;this.init=function(_design_config){var self=this;design_config=_design_config;this.preloadImages();this.initLargeView();this.initEffects();this.initDesigns();this.setInitiallySelectedDesign();}
this.getSelectedDesignID=function(){var objs=$$('.thumbselect');if(objs.length==0){return"";}
return objs[0].get('design_id');}
this.isSelectedDesignSupported=function(){var selected_design_id=this.getSelectedDesignID();if(selected_design_id==""){return false;}
if(design_config.some(function(d){return(d.id==selected_design_id&&(d.label==null||d.label==""));})){return true;}
return false;}
this.getDesignConfig=function(design_id){var designs=design_config.filter(function(d,index){if(d.id==design_id){d.index=index;return true;}return false;});if(designs.length>0)return designs[0];return null;}
this.initEffects=function(){design_filter_effect=new Fx.Morph(options.placeholders.info,{duration:1000,link:'cancel'});large_view_effect=new Fx.Morph('largeviewimg',{duration:800,link:'cancel'});var self=this;large_view_effect.addEvent('complete',function(){self.closeLargeViewComplete();});}
this.initDesigns=function(){design_config.each(function(item,index){designs.include(item.name)});this.initFilters();current_num_designs=this.fillUpDesigns();var self=this;this.display_visible_designs_handle=null;$(options.placeholders.scroll_wrapper).addEvent('scroll',function(){$clear(self.display_visible_designs_handle);self.display_visible_designs_handle=self.displayVisibleDesigns.delay(500,self);});this.initialDisplayVisibleDesigns();}
this.refresh=function(){this.displayVisibleDesigns();}
this.setInitiallySelectedDesign=function(){if(options.selected_design_id){var design_id=null;var matching_designs=$$('.thumbdiv').filter(function(e){if(e.get('design_id').toLowerCase()==options.selected_design_id.toLowerCase()){design_id=e.get('id');return true;}
return false;},this);design_id=matching_designs.length>0?matching_designs[0].get('design_id'):null;if(design_id){var self=this;this.tryToScrollToDesign(this.generateDesignID(design_id),function(){$(self.generateDesignID(design_id)).fireEvent('click');});}}}
this.tryToScrollToDesign=function(design_id,callback){if(!$(design_id))return
this.scrollToDesign(design_id);this.markAsSelected(design_id,callback);}
this.markAsSelected=function(design_id,callback){if($(design_id).hasClass('dummy')){this.tryToScrollToDesign.delay(100,this,[design_id,callback]);return;}
if(callback)callback();}
this.applyUserFilter=function(f){user_filter=f;var new_design_config=[];for(var i=0;i<design_config.length;i++){if(user_filter(design_config[i])){new_design_config.push(design_config[i]);}}
design_config=new_design_config;this.initFilters();this.setDesignFilter();this.displayVisibleDesigns();}
this.initFilters=function(){var filters=[{id:'name',text:'By Design'},{id:'color',text:'By Color'},{id:'business',text:'By Industry'},{id:'year',text:'By Year'}];var sort_f=function(a,b){return a<b?-1:(a>b?1:0);};fdropdown.empty();(new Element('option',{value:'all',html:'Show All'})).inject(fdropdown);filters.each(function(f){var items=this.extractDesignFilterValues(f.id);items.sort(sort_f);var dropdown=this.getDropdownByFilter(f.id);if(!dropdown)return;dropdown.empty();items.each(function(item,index){(new Element('option',{value:item,html:item})).inject(dropdown);});if(items.length>0){(new Element('option',{value:f.id,html:f.text})).inject(fdropdown);}
dropdown.store('cdh',this);dropdown.addEvent('change',function(){var h=this.retrieve('cdh');h.setDesignFilter(f.id,this.value);if(Browser.Engine.trident){this.focus();}},this);},this);fdropdown.store('cdh',this);fdropdown.set("value","all");fdropdown.addEvent('change',function(){var h=this.retrieve('cdh');if(this.value=="all"){h.setDesignFilter();}else{var dropdown=h.getDropdownByFilter(this.value);h.setDesignFilter(this.value,dropdown.get("value"));}},this);}
this.extractDesignFilterValues=function(type){var values={};design_config.each(function(item){if($type(item[type])=='array'){item[type].each(function(v){values[v]=true;});}else if($type(item[type])=='string'){values[item[type]]=true;}});var values_arr=[];for(var i in values)values_arr.push(i);return values_arr;}
this.toggleVisibility=function(element){$(element).toggleClass("custom_hideme");}
this.getDropdownByFilter=function(type){return dropdowns_by_filter[type];}
this.showDesign=function(el){el.setStyle('visibility','visible');}
this.matchesDesignFilter=function(design,type,value){if(type=="all")return true;if(!$type(design[type]))return false;if(value=="")return true;if($type(design[type])=='string'){return design[type].toLowerCase()==value.toLowerCase();}
if($type(design[type])=='array'){return design[type].indexOf(value)!=-1?true:false;}
return false;}
this.initialDisplayVisibleDesigns=function(){var placeholders=this.getDesignsPlaceholders();var visible_placeholders=this.getVisiblePlaceholders(placeholders);if(visible_placeholders.length==0){this.initialDisplayVisibleDesigns.delay(1000,this);return;}
this.displayVisibleDesigns();}
this.displayVisibleDesigns=function(){var placeholders=this.getDesignsPlaceholders();var visible_placeholders=this.getVisiblePlaceholders(placeholders);this.loadVisiblePlaceholders(visible_placeholders);}
this.getDesignsPlaceholders=function(){return this.placeholders;}
this.setDesignsPlaceholders=function(){this.placeholders=$$('.thumbdiv');}
this.getVisiblePlaceholders=function(placeholders){var top=$(options.placeholders.designs_wrapper).getPosition().y;var width=$(options.placeholders.designs_wrapper).getSize().x;var window_size=$(options.placeholders.scroll_wrapper).getSize();var window_scroll=$(options.placeholders.scroll_wrapper).getScroll();window_size.x=width;window_scroll.y=$(options.placeholders.designs_wrapper)==$(options.placeholders.scroll_wrapper)?window_scroll.y:window_scroll.y-top;return placeholders.filter(function(placeholder,index){return this.isVisiblePlaceholder(placeholder,index,window_size,window_scroll);},this);}
this.isVisiblePlaceholder=function(placeholder,index,window_size,window_scroll){var sz=placeholder.getSize();var pos=this.smartCalculatePlaceholderPosition(sz,index,window_size);var result=this.isVisiblePoint(pos,window_size,window_scroll)||this.isVisiblePoint({x:pos.x+sz.x,y:pos.y+sz.y},window_size,window_scroll);return result;}
this.smartCalculatePlaceholderPosition=function(size,index,window_size){var avg_cols=Math.floor(window_size.x/size.x);var col=index%avg_cols;var row=Math.floor(index/avg_cols);var col=col*size.x;var row=row*size.y;return{x:col,y:row};}
this.isVisiblePoint=function(pos,window_size,window_scroll){return(pos.x>=window_scroll.x&&pos.x<=window_scroll.x+window_size.x&&pos.y>=window_scroll.y&&pos.y<=window_scroll.y+window_size.y);}
this.loadVisiblePlaceholders=function(placeholders){placeholders.filter(function(placeholder){return placeholder.hasClass('dummy');},this).each(function(placeholder,index){this.loadDesignInPlaceholder(placeholder,placeholder.retrieve('config'),index);},this);}
this.loadDesignInPlaceholder=function(placeholder,design,index){var self=this;var t1=placeholder;t1.empty();t1.set('id',this.generateDesignID(design.id));t1.set('design_id',design.id);t1.setStyles({'display':'block'});t1.addEvents({'click':function(){$$('.thumbselect').removeClass('thumbselect');this.addClass('thumbselect');selected_design_id=this.get('id').substring(DESIGN_ID_PREFIX.length);}});t1.removeClass('dummy');if(selected_design_id&&design.id.toLowerCase()==selected_design_id.toLowerCase()){t1.addClass('thumbselect');}
var t2=new Element('div',{'id':ZOOM_ICON_ID_PREFIX+design.id,'class':'icons','title':'Click for Large view','events':{'click':function(e){zoom_design_id=this.get('id').substring(ZOOM_ICON_ID_PREFIX.length);self.setLargeView();self.openLargeView();e=e||event;e.stopPropagation?e.stopPropagation():e.cancelBubble=true;}}});var t3=new Element('div',{'class':'thumbimg waiting','id':THUMB_ID_PREFIX+design.id,'title':'Click to select this design'});var t4=new Element('div',{'class':'thumbcaptiondiv'});var t5=new Element('p',{'class':'thumbcaption','html':design.name+" "+design.theme});var t6=(fdropdown.get("value")=='all')?new Element('a',{'class':'thumbseecolors','href':'javascript:void(null)','html':'See all colors for this design','dname':design.name}).addEvent('click',function(){self.setDesignFilter("name",this.get('dname'));},this):new Element('a',{'class':'thumbseecolors','href':'javascript:void(null)','html':'Click to select this design'});var t7=null;if(design.label!=null&&design.label!=""){t7=new Element('div',{'class':'label '+design.label,'style':design.label_style?design.label_style:"",'title':design.label}).appendText(design.label);}
t2.inject(t3);t3.inject(t1);t4.inject(t1);t5.inject(t4);t6.inject(t4);if(t7)t7.inject(t3);var img=new Element('img',{src:design.thumb,styles:{display:Browser.Engine.trident?'block':'none',visibility:'hidden'}});img.addEvent('load',function(){this.setStyle('display','block');});img.inject(t3,'bottom');var showdelay=index*120;this.showDesign.delay(showdelay,this,img);t3.store('zoom_icon_id',ZOOM_ICON_ID_PREFIX+design.id);t3.addEvent('mouseenter',function(){var id=this.retrieve('zoom_icon_id');$(id).setStyle('display','block');});t3.addEvent('mouseleave',function(){var id=this.retrieve('zoom_icon_id');$(id).setStyle('display','none');});t1.addEvent('mouseenter',function(){this.addClass('over');});t1.addEvent('mouseleave',function(){this.removeClass('over');});}
this.fillUpDesigns=function(type,value){var self=this;if(typeof(type)=="undefined")type="all";if(typeof(value)=="undefined")value="";$(options.placeholders.designs).empty();$(options.placeholders.designs_wrapper).scrollTo(0,0);var num_designs=0;for(var i=0;i<design_config.length;i++){if(this.matchesDesignFilter(design_config[i],type,value)){var element=new Element('div',{'id':this.generateDesignID(design_config[i].id),'class':'thumbdiv dummy'});element.store('config',design_config[i]);element.set('design_id',design_config[i].id);element.inject($(options.placeholders.designs));new Element('div',{'class':'thumbimg waiting'}).inject(element);num_designs++;}}
this.setDesignsPlaceholders();this.displayVisibleDesigns();return num_designs;}
this.setDesignFilter=function(type,value){if(typeof(type)=="undefined")type="all";if(typeof(value)=="undefined")filter="";var filter_ddowns=[];for(var i in dropdowns_by_filter){filter_ddowns.push(i);}
filter_ddowns.each(function(id){var dropdown=this.getDropdownByFilter(id);dropdown.setStyle('display','none');},this);var dropdown=this.getDropdownByFilter(type);if(dropdown){dropdown.setStyle('display','block');dropdown.set('value',value);if(Browser.Engine.webkit){dropdown.getParent().setStyle('width',dropdown.getSize().x);}}
fdropdown.set("value",type);current_num_designs=this.fillUpDesigns(type,value);var self=this;var msg="";var back=null;var back_element=new Element('a',{'href':'javascript:void(null)','html':'Back to all designs'}).addEvent('click',function(){self.setDesignFilter()},this);switch(type){case"all":msg=current_num_designs==1?"Showing 1 design":"Showing all {d} designs".substitute({d:current_num_designs});break;case"name":msg=current_num_designs==1?"Showing <b>{s}</b> in 1 color".substitute({s:dropdown.get("value"),d:current_num_designs}):"Showing <b>{s}</b> in {d} colors".substitute({s:dropdown.get("value"),d:current_num_designs});back=back_element;break;default:msg=current_num_designs==1?"Showing <b>{s}</b> in 1 design".substitute({s:dropdown.get("value"),d:current_num_designs}):"Showing <b>{s}</b> in {d} designs".substitute({s:dropdown.get("value"),d:current_num_designs});back=back_element;break;}
msg+=".&nbsp;";$(options.placeholders.info).set('html',msg);if(back)back.inject($(options.placeholders.info));var width=$(options.placeholders.info).getSize().x;$(options.placeholders.info_bg).addClass('num_designs_msg_bg');design_filter_effect.start({'background-position':['-800',0]});design_filter_effect.chain(function(){$(options.placeholders.info_bg).removeClass('num_designs_msg_bg');var f=function(){self.hideProgressBar();if(type=="all"){$(options.placeholders.info).set('html','');}}
f.delay(1500);});}
this.hideProgressBar=function(){$(options.placeholders.info).setStyle('background-position','9999px');}
this.setLargeView=function(){var self=this;var img=$('largeviewimg');var design=this.getDesignConfig(zoom_design_id);if(!this.isLargeViewOpen()){img.setProperty('src',design.thumb);}
if(this.isLargeViewOpen()){this.openLargeViewLoadingProgress();}
img.removeEvents();img.addEvents({'load':function(){self.closeLargeViewLoadingProgress();}});img.setProperty('src',design.large);$('largeviewdesignname').set('html',design.name+" "+design.theme);}
this.openLargeViewLoadingProgress=function(){if(progress_ui)progress_ui.hide();progress_ui=new SK.UI.Progress({placeholder:$('largeviewimg'),duration:0,zindex:progress_zindex});progress_ui.init("Loading...");progress_ui.display();}
this.closeLargeViewLoadingProgress=function(){if(progress_ui)progress_ui.hide();}
this.largeViewChange=function(direction){var design=this.getDesignConfig(zoom_design_id);for(var i=0;i<design_config.length;i++){var id=(parseInt(design.index)+(i*direction)+design_config.length+direction)%design_config.length;if($(this.generateDesignID(design_config[id].id))!=null){zoom_design_id=design_config[id].id;this.setLargeView();return;}}}
this.largeViewNext=function(){this.largeViewChange(1);}
this.largeViewPrev=function(){this.largeViewChange(-1);}
this.handleKeyPressed=function(event){switch(event.key){case'right':case'space':case'down':this.largeViewNext();break;case'left':case'up':case'backspace':this.largeViewPrev()
break;}}
this.initLargeView=function(){var self=this;['largeviewimg'].each(function(e){new Element('img',{"id":e,"class":"largeview"}).inject($(options.placeholders.main));});['largeviewshadow','largeviewclose','largeviewleft','largeviewright'].each(function(e){var el=new Element('div',{"id":e,"class":"largeview"});if(e!='largeviewshadow'){el.addEvent('mouseenter',function(){this.addClass('over');});el.addEvent('mouseleave',function(){this.removeClass('over');});}
el.inject($(options.placeholders.main));});new Element('div',{"id":"largeviewcaption","class":"largeview"}).inject($(options.placeholders.main));new Element('div',{"id":"largeviewdesignname"}).inject($('largeviewcaption'));new Element('div',{"id":"largeviewdesignselect"}).inject($('largeviewcaption'));new Element('a',{html:'Select this design',href:'javascript:void(null)'}).addEvent('click',function(){$(self.getZoomDesignElementID()).fireEvent('click');self.closeLargeView();}).inject($('largeviewdesignselect'));$('largeviewimg').addEvent('click',function(){self.closeLargeView();});$('largeviewshadow').addEvent('click',function(){self.closeLargeView();});$('largeviewclose').addEvent('click',function(){self.closeLargeView();});$('largeviewleft').addEvent('click',function(){self.largeViewPrev();});$('largeviewright').addEvent('click',function(){self.largeViewNext();});$(window).addEvent('keyup',function(evt){if(self.isLargeViewOpen()){self.handleKeyPressed(evt);}});$(window).addEvent('scroll',function(evt){if(self.isLargeViewOpen()){self.handleLargeViewScroll(evt);}});$(window).addEvent('resize',function(evt){if(self.isLargeViewOpen()){self.handleLargeViewScroll(evt);}});}
this.getCenterLargeViewPos=function(){return{x:$(window).getScroll().x+$(options.placeholders.main).getPosition().x+($(options.placeholders.main).getSize().x-large_view_img_width)/2,y:$(window).getScroll().y+($(window).getSize().y-large_view_img_height)/2};}
this.openLargeView=function(){var myid=THUMB_ID_PREFIX+zoom_design_id;var mypos=$(myid).getPosition(options.placeholders.designs_wrapper);var holder=$(options.placeholders.designs_wrapper).getPosition();var scroll=Browser.Engine.trident?$(options.placeholders.designs_wrapper).getScroll():{x:0,y:0};mypos.x+=holder.x+scroll.x;mypos.y+=holder.y+scroll.y;var lv_pos=this.getCenterLargeViewPos();large_view_y=lv_pos.y;large_view_x=lv_pos.x;$('largeviewimg').setStyles({'opacity':'0','background-color':'white'});large_view_effect.start({'opacity':['0','1'],'left':[mypos.x,large_view_x],'top':[mypos.y,large_view_y],'width':['160px','600px'],'height':['120px','450px']});$('largeviewimg').setStyle('display','block');$('largeviewshadow').setStyle('display','none');$('largeviewclose').setStyle('display','none');$('largeviewleft').setStyle('display','none');$('largeviewright').setStyle('display','none');$('largeviewcaption').setStyle('display','none');this.large_view=true;}
this.handleLargeViewScroll=function(event){var lv_pos=this.getCenterLargeViewPos();large_view_x=lv_pos.x;large_view_y=lv_pos.y;this.positionLargeView();}
this.scrollToDesign=function(design_id){if($(design_id)!=null){var mysize=$(design_id).getSize();var mypos=$(design_id).getPosition(options.placeholders.designs_wrapper);var sz=$(options.placeholders.designs_wrapper).getSize();var sc=$(options.placeholders.designs_wrapper).getScroll();if(Browser.Engine.trident){mypos.x+=sc.x;mypos.y+=sc.y;}
if(!this.isVisiblePoint(mypos,sz,sc)&&!this.isVisiblePoint({x:mypos.x+mysize.x,y:mypos.y+mysize.y},sz,sc)){$(options.placeholders.designs_wrapper).scrollTo(mypos.x,mypos.y);}}}
this.closeLargeView=function(){this.closeLargeViewLoadingProgress();this.scrollToDesign(THUMB_ID_PREFIX+zoom_design_id);$('largeviewshadow').setStyle('display','none');$('largeviewclose').setStyle('display','none');$('largeviewleft').setStyle('display','none');$('largeviewright').setStyle('display','none');$('largeviewcaption').setStyle('display','none');var myid=THUMB_ID_PREFIX+zoom_design_id;var mypos={};if($(myid)!=null){mypos=$(myid).getPosition();var sc=$(options.placeholders.designs_wrapper).getScroll();if(Browser.Engine.trident){mypos.x+=sc.x;mypos.y+=sc.y;}}else{mypos.x=large_view_x+(450/2)-120;mypos.y=large_view_y+(600/2)-160;}
large_view_effect.start({'opacity':['1','0'],'left':[large_view_x,mypos.x],'top':[large_view_y,mypos.y],'width':['600px','160px'],'height':['450px','120px']});this.large_view=false;}
this.isLargeViewOpen=function(){return this.large_view==true;}
this.closeLargeViewComplete=function(){if($('largeviewimg').getStyle('opacity')==0){$('largeviewimg').setStyle('display','none');}else{this.positionLargeView();}}
this.positionLargeView=function(){$('largeviewimg').setStyles({'left':large_view_x,'top':large_view_y,'display':'block',border:'none'});$('largeviewshadow').setStyles({'left':large_view_x-50,'top':large_view_y-50,'display':'block'});$('largeviewclose').setStyles({'left':large_view_x+576,'top':large_view_y-25,'display':'block'});$('largeviewleft').setStyles({'left':large_view_x-36,'top':large_view_y+200,'display':'block'});$('largeviewright').setStyles({'left':large_view_x+583,'top':large_view_y+200,'display':'block'});$('largeviewcaption').setStyles({'left':large_view_x,'top':large_view_y+425,'display':'block'});}
this.getZoomDesignElementID=function(){return this.generateDesignID(zoom_design_id);}
this.generateDesignID=function(id){return DESIGN_ID_PREFIX+id;}
this.preloadImages=function(){['largeviewshadow','largeviewclose','largeviewleft','largeviewright','largeviewcaption'].each(function(e){var el=new Element('div',{id:e,styles:{display:'block',position:'absolute',left:-10000,top:-10000}});el.inject($(document.body));});['largeviewshadow','largeviewclose','largeviewleft','largeviewright','largeviewcaption'].each(function(e){$(e).dispose();})}}
SK.UI.DesignSelectorThumbnails=function(options)
{this.options=options||{};this.handle=null;this.init=function(){var self=this;var url_params={"mode":"short"};if(this.options.user_id){url_params.user_id=this.options.user_id;}
if(this.options.tag){url_params.tag=this.options.tag;}
if(!url_params.user_id&&!url_params.tag){var tmp_r=new Request.JSON({url:'/Shared/Html/json_default_pgroup.html',onSuccess:function(json,text){var pgroup=json;url_params.tag='TAG'+pgroup.package_code;self.default_tag=url_params.tag;self.fetchDesigns(url_params);}}).get();}else{this.fetchDesigns(url_params);}}
this.getDefaultTag=function(){return this.default_tag||"";}
this.fetchDesigns=function(url_params){var self=this;var r=new Request.JSON({url:'/Shared/Html/json_designs_collections.html',onSuccess:function(json,text){var design_config=json;self.handle=new SK.UI.DesignSelectorThumbnailsUI({placeholders:{info:"num_designs_msg",info_bg:"num_designs_msg_bg",main:"design_selector_ui",designs:"design_list",designs_wrapper:"design_mask",scroll_wrapper:self.options.scroll_wrapper||"design_mask",filter_type:"filter_type",filter_design:"filter_design",filter_color:"filter_color",filter_business:"filter_business",filter_year:"filter_year"},selected_design_id:self.options.selected_design_id?self.options.selected_design_id:''});self.handle.init(design_config);}}).get(url_params);}
this.applyUserFilter=function(f){this.handle.applyUserFilter(f);}
this.display=function(){var main=$('design_selector_ui');if(main)main.setStyle('display','block');}
this.hide=function(){var main=$('design_selector_ui');if(main)main.setStyle('display','none');}
this.resize=function(width,height){$('design_mask').setStyles({width:width,height:height});this.refresh();}
this.getSelectedDesignID=function(){return this.handle.getSelectedDesignID();}
this.getDesignConfig=function(design_id){return this.handle.getDesignConfig(design_id);}
this.isSelectedDesignSupported=function(){return this.handle.isSelectedDesignSupported();}
this.refresh=function(){if(this.handle)this.handle.refresh();}}


SK.UI.DesignSelectorRegPersonal=function(){this.designs_config=[];this.init=function(config){this.designs_config=config;this.initDesigns(this.designs_config);}
this.initDesigns=function(designs_config){var form=document.SignUpForm;var design_dropdown=$(form.elements['Wizard__DesignID']);if(!design_dropdown)return;designs_config.each(function(d){new Element('option',{value:d.id,text:d.name}).inject(design_dropdown);});design_dropdown.store('dsh',this);design_dropdown.addEvent('change',function(){var design_id=this.get('value');var dsh=this.retrieve('dsh');dsh.displayColorSchemes(design_id);dsh.displayDesignDescription(design_id);});design_dropdown.fireEvent('change');}
this.setSelectedDesign=function(design_id){}
this.display=function(){}
this.update=function(){}
this.displayColorSchemes=function(design_id){var cs_dropdown=$(document.SignUpForm.Wizard__SchemeKey);var design=this.getDesignConfig(design_id);cs_dropdown.empty();if(!design)return;design.color_schemes.each(function(cs){new Element('option',{value:cs.id,text:cs.name,preview:cs.preview}).inject(cs_dropdown);});cs_dropdown.removeEvents('change');cs_dropdown.addEvent('change',function(){var cs_id=this.get('value');this.getChildren().each(function(e){if(e.get('selected')){if($('template_layout_preview')){$('template_layout_preview').set('src',e.get('preview'));}}});});cs_dropdown.fireEvent('change');}
this.displayDesignDescription=function(design_id){var design=this.getDesignConfig(design_id);var description=design?design.description:"";$('DesignDescriptionPlaceholder').set('html',description);}
this.getDesignConfig=function(design_id){var designs=this.designs_config.filter(function(d){return d.id==design_id;});if(designs.length>0)return designs[0];return null;}}
SK.UI.DesignSelectorRegBusiness=function(options){this.options=options;this.handle=null;var large_design_box=true;var document_body_effect=null;var design_mask_effect=null;this.init=function(){var self=this;document_body_effect=new Fx.Scroll(document.body,{duration:1000,link:'cancel'});design_mask_effect=new Fx.Morph('design_mask',{duration:700,link:'cancel',onComplete:function(){self.handle.refresh();}});['toggle_designlist_size_expand','toggle_designlist_size_collapse'].each(function(id){$(id).addEvent('click',self.toggleDesignListSize);});this.handle=new SK.UI.DesignSelectorThumbnails({tag:this.options.tag});this.handle.init();}
this.display=function(){this.handle.display();}
this.update=function(){var self=this;var selected_design_id=this.handle.getSelectedDesignID();if(!selected_design_id){return false;}
var design=this.handle.getDesignConfig(selected_design_id);this.setFormElement('Wizard__CollectionDesignID',selected_design_id);this.setFormElement('Wizard__SelectDesignUI','thumbnails');new Hash(design.site_properties).getKeys().each(function(key){self.setFormElement('Wizard__'+key,design.site_properties[key]);});return true;}
this.getDefaultTag=function(){return this.handle.getDefaultTag();}
this.setFormElement=function(name,value){var form=document.SignUpForm;if(form.elements[name]){form.elements[name].value=value;}else{new Element('input',{'type':'hidden','name':name,'value':value}).inject($(form));}}
this.toggleDesignListSize=function(){large_design_box=!large_design_box;var m=$('stock_designs').getCoordinates();if(large_design_box){var h=335;design_mask_effect.start({'height':h});document_body_effect.start($(window).getScroll().x,m.top-20);$('toggle_designlist_size_expand').setStyle('display','block');$('toggle_designlist_size_collapse').setStyle('display','none');}else{design_mask_effect.start({'height':$(window).getSize().y-140});document_body_effect.start($(window).getScroll().x,m.top-20);$('toggle_designlist_size_expand').setStyle('display','none');$('toggle_designlist_size_collapse').setStyle('display','block');}}
this.scrollToFit=function(element){var w=$(window).getSize();var n=$(window).getScroll();var m=$(element).getCoordinates();var s=$(element).getScroll();var ms=(m.bottom+s.y)-(n.y+w.y)+20;if(ms>0){document_body_effect.start(0,n.y+ms);}}}


SK.UI.Tip=new Class({Extends:Tips,initialize:function(element,title,text,options){this.element=$(element);this.title=title;this.text=text;this.options=options||{};this.element.store('tip:title',this.title);this.element.store('tip:text',this.text);this.parent([this.element],$extend(this.options,{className:'sk-tip',fixed:true,offsets:this.getOffsets()}));this.addEvents({'show':function(e){e.fade('in');},'hide':function(e){e.fade('out');}});},getOffsets:function(){if(this.options.onoffset){return this.options.onoffset(this.element);}else{return{x:0,y:this.element.getSize().y+10};}},attach:function(elements){$$(elements).each(function(element){var title=element.retrieve('tip:title',element.get('title'));var text=element.retrieve('tip:text',element.get('rel')||element.get('href'));var enter=element.retrieve('tip:enter',this.elementEnter.bindWithEvent(this,element));var leave=element.retrieve('tip:leave',this.elementLeave.bindWithEvent(this,element));element.addEvents({focus:enter,blur:leave});if(!this.options.fixed){var move=element.retrieve('tip:move',this.elementMove.bindWithEvent(this,element));element.addEvent('mousemove',move);}
element.store('tip:native',element.get('title'));element.erase('title');},this);return this;},detach:function(elements){$$(elements).each(function(element){element.removeEvent('focus',element.retrieve('tip:enter')||$empty);element.removeEvent('blur',element.retrieve('tip:leave')||$empty);element.removeEvent('mousemove',element.retrieve('tip:move')||$empty);element.eliminate('tip:enter').eliminate('tip:leave').eliminate('tip:move');var original=element.retrieve('tip:native');if(original)element.set('title',original);});return this;}});


SK.UI.Registration=new Class({MIN_PASSWORD_LENGTH:4,MIN_LOGIN_NAME_LENGTH:2,TIPS:{Login:'The "Login" will be part of your temporary URL e.g.\n http://'+document.location.host+'/YourLoginName\nuntil your domain name is configured.',Email:'To this email we will send the instructions on how to activate your account and how to reset your forgotten password.\n So make sure you provide a valid email.',Name:'Enter the name of your organization or personal name. It will be used in the initial content of your site and as the first part of the browser title for your pages',Password:'4-8 characters',Phone:'Please provide a valid phone number if you like to get a free technical support during the trial.'},SIGNUP_MESSAGES:{'ENTER_NAME':"Please enter your name",'ENTER_EMAIL':"Please enter your email",'ENTER_LOGIN':"Please enter a login",'ENTER_VALID_EMAIL':"Please enter a valid email",'ENTER_PASSWORD':"Please enter your password",'ENTER_ACTIVATION_KEY':"Please enter your activation code",'PASSWORDS_DONT_MATCH':"The passwords don't match. Please try again.",'INVALID_PHOTO_FILE':"Please browse to a valid photo image file.",'LOGIN_DUPLICATE':'A user with login "{s}" already exists!','LOGIN_LENGTH':"Your login must be at least {d} characters long!",'PASSWORD_LENGTH':"Password must be at least {d} characters long!",'LOGIN_INCORRECT':"The login is incorrect. Your login may contain only latin letters, digits, underscore sign (_), dash (-) or dot (.)",'TERMS_NOT_CHECKED':"You cannot become a member without agreement to Terms of Use and Legal statements"},initialize:function(options){this.options=options;this.allowFormSubmission.delay(7*1000);if(!this.options){this.options={};}
if(!this.options.callbacks){this.options.callbacks={};}
var self=this;$(window).addEvent('load',function(){self.attachTips();});if(this.options.callbacks.oninit){this.options.callbacks.oninit();}
if(this.options.content){this.initContent();}},initContent:function(){if(this.options.content){var elements=[];var home_page=this.options.content.home_page_layouts[0];elements.push({value:home_page.node_id,name:'Wizard__HomePageNode'});this.options.content.pages.each(function(e,index){this.push({value:e.node_id,name:'Wizard_'+index});},elements);this.options.content.replacements.each(function(e,index){this.push({name:'Wizard__'+e.name,value:e.value});},elements);elements.each(function(e){new Element('input',{type:'hidden',name:e.name,value:e.value}).inject(this);},document.SignUpForm);}},submit:function()
{this.resetErrors();if(!AreCookiesEnabled()){AlertNotEnabledCookiesMessage();return;}
if(!this.isRegistrationFormAllowedForSubmission())return;var form=document.SignUpForm;form.Wizard__Login.value=Trim(form.Wizard__Login.value);form.Wizard__Password.value=Trim(form.Wizard__Password.value);form.Wizard__ConfirmPassword.value=Trim(form.Wizard__ConfirmPassword.value);form.Wizard__Email.value=Trim(form.Wizard__Email.value);if(form.Wizard__Login.value==''){this.setError('login',this.SIGNUP_MESSAGES['ENTER_LOGIN']);form.Wizard__Login.focus();return false;}
if(!this.validateLoginLength(form.Wizard__Login.value)){form.Wizard__Login.focus();return false;}
if(!IsValid(form.Wizard__Login.value,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.-')){this.setError('login',this.SIGNUP_MESSAGES['LOGIN_INCORRECT']);form.Wizard__Login.focus();return false;}
if(form.Wizard__Password.value==''){this.setError('password',this.SIGNUP_MESSAGES['ENTER_PASSWORD']);form.Wizard__Password.focus();return false;}
if(!this.validatePasswordLength(form.Wizard__Password.value)){form.Wizard__Password.focus();return false;}
if(form.Wizard__Password.value!=form.Wizard__ConfirmPassword.value){this.setError('password',this.SIGNUP_MESSAGES['PASSWORDS_DONT_MATCH']);form.Wizard__ConfirmPassword.value="";form.Wizard__Password.select();return false;}
if(typeof(form.elements["Wizard__Name"])!='undefined'){form.Wizard__Name.value=Trim(form.Wizard__Name.value);if(form.Wizard__Name.value==''){form.Wizard__Name.value='Site Name';}}
if(form.Wizard__Email.value==''){this.setError('email',this.SIGNUP_MESSAGES['ENTER_EMAIL']);form.Wizard__Email.focus();return false;}
if(!this.validEmail(form.Wizard__Email.value)){this.setError('email',this.SIGNUP_MESSAGES['ENTER_VALID_EMAIL']);form.Wizard__Email.select();return false;}
if(form.Wizard__Photo&&form.Wizard__Photo.value!=''){if(!this.checkFileExtension(form.Wizard__Photo.value,["gif","jpg","jpeg","png","bmp"])){this.setError('photo',this.SIGNUP_MESSAGES['INVALID_PHOTO_FILE']);form.Wizard__Photo.focus();return false;}}
if(!form.IAgree.checked){this.setError('iagree',this.SIGNUP_MESSAGES['TERMS_NOT_CHECKED']);return false;}
if(this.options.callbacks.onsubmit){if(this.options.callbacks.onsubmit()==false){return false;}}
if(typeof(form.elements["do_register"])!='undefined')
form.do_register.value="go";var oSubmitButton=document.getElementById('sign_up_submit_button');if(oSubmitButton!=null){oSubmitButton.disabled=true;}
var progress_ui=new SK.UI.Progress();progress_ui.init('Registering...');progress_ui.display();document.SignUpForm.submit();return true;},allowFormSubmission:function(){if(document.SignUpForm){document.SignUpForm.setAttribute('registration_allowed',1);}},isRegistrationFormAllowedForSubmission:function(){var form=document.SignUpForm;return(form&&form.getAttribute('registration_allowed')&&form.getAttribute('registration_allowed')!="");},setRegisteredUserCookie:function(){Cookie.write('Registered__User',1,{duration:99999});},isExistingAccount:function(user_login){var self=this;if(user_login!=''){if(this.validateLoginLength(user_login)){var r=new Request.JSON({url:'/Shared/Html/validate_existent_user.html',onSuccess:function(json,text){var existent_user=json;if(existent_user.exists==1){self.setError('login',self.SIGNUP_MESSAGES['LOGIN_DUPLICATE'].substitute({s:user_login}));if(self.options.callbacks.onaccountexists)
self.options.callbacks.onaccountexists();}else{self.setError('login',"");}}}).get({"LoginRequested":user_login,"_x":(new Date()).getTime()});}}else{this.setError('login',self.SIGNUP_MESSAGES['ENTER_LOGIN'])}},setError:function(elmt_id,err_str,subst_value){var oErrorLabel=document.getElementById('signup_error');if(oErrorLabel){if(subst_value!=null){err_str=err_str.replace(/\@\@\@/,subst_value);}
oErrorLabel.innerHTML=(typeof(err_str)!='undefined')?err_str:'&nbsp;';}},resetErrors:function(){this.setError('','');},validatePasswordLength:function(str_password){if(str_password.length<this.MIN_PASSWORD_LENGTH){this.setError('password',this.SIGNUP_MESSAGES['PASSWORD_LENGTH'].substitute({d:this.MIN_PASSWORD_LENGTH}));return false;}else{this.setError('password','');return true;}},validateLoginLength:function(str_login){if(str_login.length<this.MIN_LOGIN_NAME_LENGTH){this.setError('login',this.SIGNUP_MESSAGES['LOGIN_LENGTH'].substitute({d:this.MIN_LOGIN_NAME_LENGTH}));return false;}else{this.setError('password','');return true;}},validateEmail:function(email){if(email==""){this.setError('email',this.SIGNUP_MESSAGES['ENTER_EMAIL']);return false;}
if(!this.validEmail(email)){this.setError('email',this.SIGNUP_MESSAGES['ENTER_VALID_EMAIL']);}else{this.setError('email','');return true;}},validEmail:function(email)
{return(email.indexOf("@")!=-1&&email.indexOf(".")!=-1);},checkFileExtension:function(sFileSrc,arrAllowedExtensions){var sFileExt=this.getFileExtension(sFileSrc);sFileExt=sFileExt.toLowerCase();for(var i=0;i<arrAllowedExtensions.length;i++){if(sFileExt==arrAllowedExtensions[i].toLowerCase()){return true;}}
return false;},getFileExtension:function(sFileSrc){var re=new RegExp(".*\\.(.*)$","ig");var _tmp=re.exec(sFileSrc);var sExt=RegExp.$1;return sExt;},attachTips:function(){['Login','Password','Name','Email','Phone'].each(function(type){if($defined(this.TIPS[type])){var element=document.SignUpForm.elements['Wizard__'+type];if(element)
this.attachTip(element,type,this.TIPS[type]);}},this);},attachTip:function(element,title,text,options){new SK.UI.Tip(element,title,text,options);},setCallbacks:function(callbacks){if(!$defined(this.options.callbacks)){this.options.callbacks={};}
this.options.callbacks=$extend(callbacks,this.options.callbacks);},getFormField:function(name){var form=$(document.SignUpForm);if(form.elements[name]){return form.elements[name].value;}else{return"";}},setFormField:function(name,value){var form=$(document.SignUpForm);if(form.elements[name]){form.elements[name].value=value;}else{new Element('input',{'type':'hidden','name':name,'value':value}).inject(form);}}});


SK.UI.RegistrationQuick=new Class({Extends:SK.UI.Registration,initialize:function(options){var self=this;this.parent({content:options.content,callbacks:{"onsubmit":function(){return true;}}});},attachTip:function(element,title,text,options){new SK.UI.Tip(element,title,text,{onoffset:function(element){return{x:element.getSize().x,y:0};}});}});


SK.UI.RegistrationPersonal=new Class({Extends:SK.UI.Registration,initialize:function(options){var self=this;this.designs_config=options.designs;this.design_ui_handle=new SK.UI.DesignSelectorRegPersonal();this.parent({content:options.content,callbacks:{"oninit":function(){self.design_ui_handle.init(self.designs_config);},"onsubmit":function(){return true;}}});},attachTip:function(element,title,text,options){new SK.UI.Tip(element,title,text,{onoffset:function(element){return{x:element.getSize().x,y:0};}});}});


SK.UI.RegistrationBusiness=new Class({Extends:SK.UI.Registration,initialize:function(options){var self=this;this.options=options;if(!$defined(this.options.content)){this.options.content={};}
if(!$defined(this.options.content.home_page_layouts)){this.options.content.home_page_layouts=[];}
if(!$defined(this.options.content.pages)){this.options.content.pages=[];}
if(!$defined(this.options.content.replacements)){this.options.content.replacements=[];}
if(!$defined(this.callbacks)){this.callbacks={};}
this.content=this.options.content;this.design_ui_handle=new SK.UI.DesignSelectorRegBusiness({tag:this.getTag()||""});this.initAccountDetailsBlock();this.initEditContentBlock();this.parent({callbacks:{"oninit":function(){self.design_ui_handle.init();self.design_ui_handle.display();},"onsubmit":function(){if(self.design_ui_handle.update()==false){self.setError('design',"Please select a design by clicking its thumbnail preview");return false;}
return self.onSubmit();}}});},initAccountDetailsBlock:function(){var user_details=this.options.content.user_details;if(!$defined(user_details))return;var mandatory={'login':true,'password':true,'email':true};['login','password','name','email','phone'].each(function(e){var field_placeholder=$$('.main-field-'+e)[0];if(field_placeholder&&user_details[e]){var element=user_details[e];if(element.caption){var label=field_placeholder.getChildren('label')[0];if(label)label.set('html',element.caption+(mandatory[e]?'*':''));}
if(element.tip){var e_camel_case=(""+e.charAt(0)).toUpperCase()+e.substring(1);this.TIPS[e_camel_case]=element.tip;}
field_placeholder.setStyle('display','inline-block');}},this);if(user_details['phone']){$$('.main-fields')[0].addClass('extended');$$('.main-field-none').each(function(e){e.setStyle('display','block');});}},initEditContentBlock:function(){var on=$$('.edit-content-title-toggle-on')[0];var off=$$('.edit-content-title-toggle-off')[0];var edit_content_body=$$('.edit-content-body-wrapper')[0];on.store('h',this);off.store('h',this);on.addEvent('click',function(){edit_content_body.setStyle('display','block');off.setStyle('display','block');on.setStyle('display','none');$('prefill_site').set('checked',true);var h=this.retrieve('h');h.attachReplacementsTooltips();});off.addEvent('click',function(){edit_content_body.setStyle('display','none');off.setStyle('display','none');on.setStyle('display','block');var h=this.retrieve('h');h.attachReplacementsTooltips();});$('prefill_site').addEvent('click',function(){if(this.checked==false){off.fireEvent('click');}});this.initHomePageLayouts();this.initPages();this.initReplacements();},initHomePageLayouts:function(){var page_layouts=this.options.content.home_page_layouts||[];var placeholders=$$('.edit-content-body-layout-layouts');if(placeholders.length==0)return;var placeholder=placeholders[0];placeholder.empty();page_layouts.each(function(l,index){var element=new Element('div',{'class':'home-page-layout'+(index==0?' selected':'')});var img=new Element('img',{'src':l.preview,'id':l.node_id});img.inject(element);element.addEvent('click',function(){$$('.home-page-layout').each(function(e){e.removeClass('selected');});this.addClass('selected');});element.inject(placeholder);});},initPages:function(){var pages=this.options.content.pages||[];var placeholders=$$('.edit-content-body-names-pages');if(placeholders.length==0)return;var placeholder=placeholders[0];placeholder.empty();pages.each(function(page,index){if($defined(page.editable)&&page.editable==1){var element=new Element('div',{'class':'page-name'});element.inject(placeholder);var page_switch=new Element('div',{'class':'page-name-switch'});page_switch.inject(element);new Element('input',{'type':'checkbox','checked':'checked','name':'Wizard_'+(index+1),'value':page.node_id}).addEvent('click',function(){$('Name_'+index).set('disabled',this.checked?false:true);}).inject(page_switch);var page_field=new Element('div',{'class':'page-name-field'});page_field.inject(element);new Element('input',{'id':'Name_'+index,'type':'text','name':'Wizard__'+page.replacement,'value':page.name,'events':{'blur':function(){if(this.value.trim()==""){this.value=this.retrieve('default_value');}}}}).store('default_value',page.name).inject(page_field);}else{new Element('input',{'type':'hidden','name':'Wizard_'+(index+1),'value':page.node_id}).inject(placeholder);}});},initReplacements:function(){var replacements=this.options.content.replacements||[];var placeholders=$$('.edit-content-body-variables');if(placeholders.length==0)return;var placeholder=placeholders[0];placeholder.empty();replacements.each(function(replacement,index){if($defined(replacement.editable)&&replacement.editable==1){var element=new Element('div',{'class':'variable'});element.inject(placeholder);var label=new Element('label',{'for':'Replacement_'+index,'text':replacement.caption});label.inject(element);var field=null;if($defined(replacement.multiline)&&replacement.multiline==1){field=new Element('textarea',{'name':'Wizard__'+replacement.name,'id':'Replacement_'+index,'text':replacement.value});}else{field=new Element('input',{'type':'text','name':'Wizard__'+replacement.name,'id':'Replacement_'+index,'value':replacement.value});}
if($defined(replacement.style)){field.set('style',replacement.style);}
field.inject(element);}else{new Element('input',{'type':'hidden','name':'Wizard__'+replacement.name,'value':replacement.value}).inject(placeholder);}},this);},attachReplacementsTooltips:function(){var replacements=this.content.replacements||[];replacements.each(function(replacement,index){if($defined(replacement.editable)&&replacement.editable==1){if(replacement.tip){var field=document.SignUpForm.elements['Wizard__'+replacement.name];if(field)
this.attachTip(field,replacement.caption,replacement.tip);}}},this);},getHomePageLayout:function(){var selected_layouts=$$('.home-page-layout').filter(function(e){return e.hasClass('selected');});if(selected_layouts.length==0)return"";var layout=selected_layouts[0];var img=layout.getChildren('img')[0];return{node_id:img.id};},onSubmit:function(){var use_prefilled_content=$('prefill_site').checked?true:false;var form=$(document.SignUpForm);this.setFormField('Wizard__SiteTitle',form.elements['Wizard__Name'].value);this.setFormField('Wizard__Tags',this.getTag());if(use_prefilled_content){var home_page=this.getHomePageLayout();this.setFormField('Wizard__HomePageNode',home_page.node_id);var some_index=100000;while(form.elements['Wizard_'+some_index]){some_index++;}
this.setFormField('Wizard_'+some_index,home_page.node_id);}else{$$('input').each(function(e){if(e&&e.get&&e.get('name')&&e.get('name').indexOf("Wizard_")==0&&e.get('name').indexOf("Wizard__")==-1){e.dispose();}});}
if(form.elements['Wizard__HomePageNode']&&form.elements['Wizard__HomePageNode'].value==""){this.setError("generic","No home page selected. Please select one.");return false;}
if(this.callbacks.onsubmit){this.callbacks.onsubmit(this);}
return true;},getTag:function(){var anchor=document.location.hash;if(anchor&&anchor.indexOf("tag_")==1){var tag=anchor.substring(5);Cookie.write('tag',tag);return tag;}
var cookie_tag=Cookie.read('tag');if(cookie_tag)return cookie_tag;if(this.design_ui_handle){return this.design_ui_handle.getDefaultTag();}
return"";},getErrorTypes:function(){return{'generic':'.registration .generic-error','login':'.registration .main-field-login','password':'.registration .main-field-password','name':'.registration .main-field-name','email':'.registration .main-field-email','design':'.registration .insidebox'};},setError:function(elm_type,err_str,subst_value){var error_types=this.getErrorTypes();var elm_class=error_types[elm_type]?error_types[elm_type]:"signup_error";var placeholders=$$('.'+elm_class);var placeholder=placeholders.length>0?placeholders[0]:$('signup_error');if(placeholder){if(subst_value!=null){err_str=err_str.replace(/\@\@\@/,subst_value);}
placeholder.getChildren('.error-message').each(function(e){e.dispose();});if(err_str==""){placeholder.removeClass('error');}else{placeholder.addClass('error');new Element('div',{'class':'error-message','html':(typeof(err_str)!='undefined')?err_str:'&nbsp;'}).inject(placeholder);}}},resetErrors:function(){var error_types=this.getErrorTypes();for(var i in error_types){this.setError(i,'');}},setCallbacks:function(callbacks){this.callbacks=$extend(callbacks,this.callbacks);}});

