
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. Uploading files over 100Mb is not recommended.';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. Uploading files over 100Mb is not recommended.';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;}}

;(function(window,document,undefined){var prefixes=['webkit','Moz','ms','O'],animations={},useCssAnimations;function createEl(tag,prop){var el=document.createElement(tag||'div'),n;for(n in prop){el[n]=prop[n];}
return el;}
function ins(parent,child1,child2){if(child2&&!child2.parentNode)ins(parent,child2);parent.insertBefore(child1,child2||null);return parent;}
ins(document.getElementsByTagName('head')[0],createEl('style'));var sheet=document.styleSheets[document.styleSheets.length-1];function addAnimation(alpha,trail,i,lines){var name=['opacity',trail,~~(alpha*100),i,lines].join('-'),start=0.01+i/lines*100,z=Math.max(1-(1-alpha)/trail*(100-start),alpha),prefix=useCssAnimations.substring(0,useCssAnimations.indexOf('Animation')).toLowerCase(),pre=prefix&&'-'+prefix+'-'||'';if(!animations[name]){sheet.insertRule('@'+pre+'keyframes '+name+'{'+'0%{opacity:'+z+'}'+
start+'%{opacity:'+alpha+'}'+
(start+0.01)+'%{opacity:1}'+
(start+trail)%100+'%{opacity:'+alpha+'}'+'100%{opacity:'+z+'}'+'}',0);animations[name]=1;}
return name;}
function vendor(el,prop){var s=el.style,pp,i;if(s[prop]!==undefined)return prop;prop=prop.charAt(0).toUpperCase()+prop.slice(1);for(i=0;i<prefixes.length;i++){pp=prefixes[i]+prop;if(s[pp]!==undefined)return pp;}}
function css(el,prop){for(var n in prop){el.style[vendor(el,n)||n]=prop[n];}
return el;}
function defaults(obj,def){for(var n in def){if(obj[n]===undefined)obj[n]=def[n];}
return obj;}
function pos(el){var o={x:el.offsetLeft,y:el.offsetTop};while((el=el.offsetParent)){o.x+=el.offsetLeft;o.y+=el.offsetTop;}
return o;}
var Spinner=function Spinner(o){this.opts=defaults(o||{},{lines:12,length:7,width:5,radius:10,color:'#000',speed:1,trail:100,opacity:1/4});},proto=Spinner.prototype={spin:function(target){var self=this,el=self.el=css(createEl(),{position:'relative'}),ep,tp;if(target){tp=pos(ins(target,el,target.firstChild));ep=pos(el);css(el,{left:(target.offsetWidth>>1)-ep.x+tp.x+'px',top:(target.offsetHeight>>1)-ep.y+tp.y+'px'});}
self.lines(el,self.opts);if(!useCssAnimations){var o=self.opts,i=0,f=20/o.speed,ostep=(1-o.opacity)/(f*o.trail/100),astep=f/o.lines;(function anim(){i++;for(var s=o.lines;s;s--){var alpha=Math.max(1-(i+s*astep)%f*ostep,o.opacity);self.opacity(el,o.lines-s,alpha,o);}
self.timeout=self.el&&setTimeout(anim,50);})();}
return self;},stop:function(){var self=this,el=self.el;clearTimeout(self.timeout);if(el&&el.parentNode)el.parentNode.removeChild(el);self.el=undefined;return self;}};proto.lines=function(el,o){var i=0,seg;function fill(color,shadow){return css(createEl(),{position:'absolute',width:(o.length+o.width)+'px',height:o.width+'px',background:color,boxShadow:shadow,transformOrigin:'left',transform:'rotate('+~~(360/o.lines*i)+'deg) translate('+o.radius+'px'+',0)',borderRadius:(o.width>>1)+'px'});}
for(;i<o.lines;i++){seg=css(createEl(),{position:'absolute',top:1+~(o.width/2)+'px',transform:'translate3d(0,0,0)',opacity:o.opacity,animation:useCssAnimations&&addAnimation(o.opacity,o.trail,i,o.lines)+' '+1/o.speed+'s linear infinite'});if(o.shadow)ins(seg,css(fill('#000','0 0 4px '+'#000'),{top:2+'px'}));ins(el,ins(seg,fill(o.color,'0 0 1px rgba(0,0,0,.1)')));}
return el;};proto.opacity=function(el,i,val){el.childNodes[i].style.opacity=val;};(function(){var s=css(createEl('group'),{behavior:'url(#default#VML)'}),i;if(!vendor(s,'transform')&&s.adj){for(i=4;i--;)sheet.addRule(['group','roundrect','fill','stroke'][i],'behavior:url(#default#VML)');proto.lines=function(el,o){var r=o.length+o.width,s=2*r;function grp(){return css(createEl('group',{coordsize:s+' '+s,coordorigin:-r+' '+-r}),{width:s,height:s});}
var g=grp(),margin=~(o.length+o.radius+o.width)+'px',i;function seg(i,dx,filter){ins(g,ins(css(grp(),{rotation:360/o.lines*i+'deg',left:~~dx}),ins(css(createEl('roundrect',{arcsize:1}),{width:r,height:o.width,left:o.radius,top:-o.width>>1,filter:filter}),createEl('fill',{color:o.color,opacity:o.opacity}),createEl('stroke',{opacity:0}))));}
if(o.shadow){for(i=1;i<=o.lines;i++){seg(i,-2,'progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)');}}
for(i=1;i<=o.lines;i++){seg(i);}
return ins(css(el,{margin:margin+' 0 0 '+margin}),g);};proto.opacity=function(el,i,val,o){o=o.shadow&&o.lines||0;el.firstChild.childNodes[i+o].firstChild.firstChild.opacity=val;};}
else{useCssAnimations=vendor(s,'animation');}})();window.Spinner=Spinner;})(window,document);


SK.UI.Progress=new Class({Implements:[Options],disturbing_elements:[],id:Math.round(Math.random()*new Date().getTime())%1000,ie6:document.all&&navigator.appVersion.indexOf("MSIE 6")!=-1?true:false,ie7:document.all&&navigator.appVersion.indexOf("MSIE 7")!=-1?true:false,ff2:navigator.userAgent.toLowerCase().indexOf("firefox/2")!=-1?true:false,ff1:navigator.userAgent.toLowerCase().indexOf("firefox/1")!=-1?true:false,mac:navigator.userAgent.toLowerCase().indexOf("macintosh")!=-1?true:false,ff2mac:this.ff2&&this.mac,ff1mac:this.ff1&&this.mac,safari:navigator.appVersion.indexOf("Safari")!=-1?true:false,WRAPPER_OPACITY:1.0,BG_OPACITY:0.7,DEFAULT_THEME_NAME:"black",isDisplayed:false,isInitialized:false,SPINNER_COLORS:{light:'#000000',black:'#ffffff'},options:{callbacks:{},theme:null,placeholder:$(document),spinner:{lines:10,length:10,width:3,radius:10,color:'#ffffff',speed:1,trail:50,shadow:false}},placeholders:{},initialize:function(options){this.setOptions(options);if(!$defined(this.SPINNER_COLORS[this.options.theme])){this.options.theme=this.DEFAULT_THEME_NAME;}
this.collectPlaceholders();var active_progress=this.placeholders.wrapper.retrieve('instance');if(active_progress){active_progress.executeCallback('beforehide');active_progress.executeCallback('afterhide');active_progress.setOptions(this.options);this.placeholders.wrapper.set('class',this.options.theme);return active_progress;}
this.bounds={center:this.center.bind(this)}
this.placeholders.wrapper.store('instance',this);return this;},collectPlaceholders:function(){['progress_ui_wrapper','progress_ui_content_animation','progress_ui_message','progress_ui_background','skwaiting_stripe'].each(function(el_id){this.placeholders[el_id.replace('progress_ui_','')]=$(el_id);},this);},init:function(message,callbacks){this.message=message;if(typeof(callbacks)!='undefined'){this.options.callbacks=$extend(this.options.callbacks,callbacks);}
if(this.isInitialized){return;}
this.create();this.reset();window.addEvent('scroll',this.bounds.center);window.addEvent('resize',this.bounds.center);this.isInitialized=true;},create:function(){if(this.options.zindex){this.placeholders.wrapper.setStyles({'z-index':this.options.zindex});}},destroy:function(){window.removeEvent('scroll',this.bounds.center);window.removeEvent('resize',this.bounds.center);this.isInitialized=false;this.isDisplayed=false;this.placeholders.wrapper.store('instance',null);if(this.options.zindex){this.placeholders.wrapper.setStyles({'z-index':''});}},reset:function(){this.disturbing_elements=[];},display:function(){if(this.isDisplayed){this.setMessage(this.message);this.executeCallback('beforedisplay');this.callAfterDisplay();this.executeCallback('afterdisplay');return;}
this.isDisplayed=true;this.collectDisturbingElements();this.hideDisturbingElements();this.center();this.executeCallback('beforedisplay');this.displayContents();this.executeCallback('afterdisplay');},hide:function(){this.executeCallback('beforehide');this.hideContents();this.displayDisturbingElements();this.destroy();this.executeCallback('afterhide');},getCallback:function(event_id){if(typeof SK=='undefined'||typeof SK.Singletons=='undefined'||typeof SK.Singletons.env=='undefined'){return null;}
var callback=SK.Singletons.env.get('SK.UI.Progress.on'+event_id);return callback==''?null:eval(callback);},executeCallback:function(event_id){var callback=this.getCallback(event_id);if(callback!=null){callback(this);}},getContentPlaceholder:function(){return this.placeholders.content_animation;},setMessage:function(message){this.placeholders.message.innerHTML=message;},callAfterDisplay:function(){if(this.options.callbacks.onafterdisplay){this.options.callbacks.onafterdisplay();}},displayContents:function(){this.setMessage(this.message);this.placeholders.wrapper.setStyles({'opacity':'0.0','display':'block'});this.placeholders.wrapper.set('class',this.options.theme);var wrapper_opacity=this.WRAPPER_OPACITY;var bg_opacity=this.BG_OPACITY;this.options.duration=0;if(this.options.duration==0){this.placeholders.wrapper.setStyle('opacity',wrapper_opacity);this.placeholders.background.setStyle('opacity',bg_opacity);this.startImagesAnimation();this.callAfterDisplay();}else{new Fx.Morph(this.placeholders.wrapper,{duration:this.options.duration?this.options.duration:200,transition:Fx.Transitions.Sine.easeOut,onComplete:function(){this.startImagesAnimation();this.callAfterDisplay.bind(this);}.bind(this)}).start({opacity:wrapper_opacity});this.placeholders.background.setStyles({'opacity':'0.0','display':'block'});new Fx.Morph(this.placeholders.background,{duration:this.options.duration?this.options.duration:200,transition:Fx.Transitions.Sine.easeOut}).start({opacity:bg_opacity});}},startImagesAnimation:function(){var spinner_diameter=(this.options.spinner.radius+this.options.spinner.length)*2;this.placeholders.skwaiting_stripe.setStyles({width:spinner_diameter,height:spinner_diameter});this.options.spinner.color=this.SPINNER_COLORS[this.options.theme];this.spinner=new Spinner(this.options.spinner).spin(this.placeholders.skwaiting_stripe);if(Browser.Engine.trident){$(this.spinner.el).setStyles({'margin':null,'top':null,'left':null});}},stopImagesAnimation:function(){if(this.spinner)this.spinner.stop();},hideContents:function(){this.placeholders.wrapper.setStyle('display','none');this.stopImagesAnimation();},isFullOfBugsIE:function(){return((document.compatMode=='BackCompat'&&Browser.Engine.trident)||(document.compatMode!='BackCompat'&&Browser.Engine.trident4==true));},center:function(){var p=$(this.options.placeholder);var size=p.getSize();var scroll=p.getScroll();var pos=p.getCoordinates();if(this.isFullOfBugsIE()){this.placeholders.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';this.placeholders.wrapper.setStyles({'position':position,'left':0+pos.left,'top':0+pos.top});}
$$('#progress_ui_wrapper, #progress_ui_background, #progress_ui_foreground, #progress_ui_content').setStyles({width:size.x,height:size.y});},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');}}},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);}}},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);}}}},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);}},changeTheme:function(theme_name){this.options.theme=theme_name||this.DEFAULT_THEME_NAME;},changeMessage:function(message){this.message=message;},getPlaceholder:function(placeholder_name){return this.placeholders[placeholder_name];}});


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.changed_design=false;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')&&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(){this.selectTheDesign($(self.generateDesignID(design_id)));}.bind(this));}}}
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.markAsSelected.delay(100,this,[design_id,callback]);return;}
this.scrollToDesign(design_id);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){if(!$(options.placeholders.designs_wrapper)||!$(options.placeholders.scroll_wrapper))return;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;if(window_size.x>0&&window_size.y>0&&placeholders&&typeof placeholders!='undefined'){return placeholders.filter(function(placeholder,index){if(!$(placeholder))return false;return this.isVisiblePlaceholder(placeholder,index,window_size,window_scroll);},this);}else{return[];}}
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){if(size.x==0){return{x:0,y:0};}
var avg_cols=Math.floor(window_size.x/size.x);if(avg_cols==0){return{x:0,y:0};}
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.changed=function(){return this.changed_design;}
this.selectTheDesign=function(element){$$('.thumbselect').removeClass('thumbselect');element.addClass('thumbselect');selected_design_id=element.get('id').substring(DESIGN_ID_PREFIX.length);}
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(){this.mgr.selectTheDesign(this.element);this.mgr.changed_design=true;}.bind({element:t1,mgr:this})});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':'zoom','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 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(t1);t3.inject(t1);t4.inject(t1);t5.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);t1.store('zoom_icon_id',ZOOM_ICON_ID_PREFIX+design.id);t1.addEvent('mouseenter',function(){this.addClass('over');var id=this.retrieve('zoom_icon_id');$(id).setStyle('display','block');});t1.addEvent('mouseleave',function(){this.removeClass('over');var id=this.retrieve('zoom_icon_id');$(id).setStyle('display','none');});}
this.fillUpDesigns=function(type,value){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 msg="";var back=null;var back_element=new Element('a',{'href':'javascript:void(null)','html':'Back to all designs'}).addEvent('click',function(){this.setDesignFilter()}.bind(this),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;";var p=new Element('p');p.set('html',msg);$(options.placeholders.info).set('html',msg);if(back)back.inject(p);$(options.placeholders.info).empty();p.inject($(options.placeholders.info));var width=$(options.placeholders.info).getSize().x;$(options.placeholders.info_bg).addClass('filter_status_bg');design_filter_effect.start({'background-position':['-800',0]});design_filter_effect.chain(function(){$(options.placeholders.info_bg).removeClass('filter_status_bg');var f=function(){this.hideProgressBar();if(type=="all"){$(options.placeholders.info).set('html','');}}.bind(this)
f.delay(1500);}.bind(this));}
this.hideProgressBar=function(){$(options.placeholders.info).setStyle('background-position','9999px');}
this.setLargeView=function(){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(){this.closeLargeViewLoadingProgress();}.bind(this)});img.setProperty('src',design.large);$('largeviewdesignname').set('html','<p>'+design.name+" "+design.theme+'</p>');}
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("");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(sz.x==0||sz.y==0){return;}
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.changed=function(){return this.handle?this.handle.changed():true;}
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:"filter_status",info_bg:"filter_status_bg",main:"ds_root",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=='#first#'&&design_config.length>0?design_config[0].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=$('ds_root');if(main)main.setStyle('display','block');}
this.hide=function(){var main=$('ds_root');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,selected_design_id:this.options.selected_design_id||""});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()}));if(!this.isLongContent(this.title,this.text)){this.tip.setStyle('width','auto');}
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;},isLongContent:function(title,text){return title.length>50||text.length>50;}});


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':"Specify an email address",'ENTER_LOGIN':"Choose a login name",'ENTER_VALID_EMAIL':"Specify a valid email address",'ENTER_PASSWORD':"Specify a 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':'The login you have chosen already exists','LOGIN_LENGTH':"Login should be at least {d} chars",'PASSWORD_LENGTH':"Password should be at least {d} chars",'LOGIN_INCORRECT':"Login may contain only latin letters, digits, underscore _, 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()
{if(this.submitted)return true;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(!this.validateLogin(form.Wizard__Login.value)){form.Wizard__Login.focus();return false;}
if(form.Wizard__Password.value==''){form.Wizard__Password.focus();this.setError('password',this.SIGNUP_MESSAGES['ENTER_PASSWORD']);return false;}
if(!this.validatePasswordLength(form.Wizard__Password.value)){form.Wizard__Password.focus();return false;}
if(form.Wizard__Password.value!=form.Wizard__ConfirmPassword.value){form.Wizard__ConfirmPassword.value="";form.Wizard__Password.select();this.setError('password',this.SIGNUP_MESSAGES['PASSWORDS_DONT_MATCH']);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;oSubmitButton.addClass('disabled');}
var progress_ui=new SK.UI.Progress();progress_ui.init('Registering...',{duration:0,onafterdisplay:function(){document.SignUpForm.submit();}});progress_ui.display();this.submitted=true;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){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){this.setError('login',this.SIGNUP_MESSAGES['LOGIN_DUPLICATE'].substitute({s:user_login}));if(this.options.callbacks.onaccountexists)
this.options.callbacks.onaccountexists();}else{this.setError('login',"");}}.bind(this)}).get({"LoginRequested":user_login,"_x":(new Date()).getTime()});}}else{this.setError('login',this.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;}},validateLogin:function(login){if(login==''){this.setError('login',this.SIGNUP_MESSAGES['ENTER_LOGIN']);return false;}
if(!this.validateLoginLength(login)){return false;}
if(!IsValid(login,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.-')){this.setError('login',this.SIGNUP_MESSAGES['LOGIN_INCORRECT']);return false;}
this.isExistingAccount(login);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()||"",selected_design_id:'#first#'});this.initAccountDetailsBlock();this.initEditContentBlock();this.initSubmitButton();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();}}});},initSubmitButton:function(){$$('.reg-submit').addEvents({'mousedown':function(){this.addClass('clicked');},'mouseup':function(){this.removeClass('clicked');},'mouseover':function(){this.addClass('over');},'mouseout':function(){this.removeClass('over');this.removeClass('clicked');},'selectstart':function(){return false;}});$$('.reg-submit p').addEvents({'selectstart':function(){return false;}});},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=$$('.reg-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','block');}},this);},initEditContentBlock:function(){var on=$$('.reg-content-on')[0];var off=$$('.reg-content-off')[0];var edit_content_body=$$('.edit-content-body')[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');});off.addEvent('click',function(){edit_content_body.setStyle('display','none');off.setStyle('display','none');on.setStyle('display','block');$('reg_content_prefill').set('checked',true);$('reg_content_body').setStyle('display','block');});$('reg_content_prefill').addEvent('click',function(){$('reg_content_body').setStyle('display',this.checked?'block':'none');});this.initHomePageLayouts();this.initPages();this.initReplacements();},initHomePageLayouts:function(){var page_layouts=this.options.content.home_page_layouts||[];var placeholders=$$('.reg-content-home');if(placeholders.length==0)return;var placeholder=placeholders[0];placeholder.empty();page_layouts.each(function(l,index){var element=new Element('div',{'class':'layout'+(index==0?' selected':'')});var img=new Element('img',{'src':l.preview,'id':l.node_id});img.inject(element);element.addEvent('click',function(){$$('.layout').each(function(e){e.removeClass('selected');});this.addClass('selected');});element.inject(placeholder);});},initPages:function(){var pages=this.options.content.pages||[];var placeholders=$$('.reg-content-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'});element.inject(placeholder);var page_switch=new Element('div',{'class':'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':'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=$$('.reg-content-texts');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':'text'});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);},attachTips:function(){['Login','Password','Name','Email','Phone'].each(function(type){var element=$(document.SignUpForm.elements['Wizard__'+type]);if(element){var error_message=$$('.reg-messages .reg-error.'+type.toLowerCase());error_message=error_message.length>0?error_message[0]:null;var tooltip_message=$$('.reg-messages .reg-tooltip.'+type.toLowerCase());tooltip_message=tooltip_message.length>0?tooltip_message[0]:null;element.addEvent('focus',function(){if(this.error_message.getStyle('display')=='none'){this.tooltip_message.setStyle('display','block');}}.bind({error_message:error_message,tooltip_message:tooltip_message}));element.addEvent('blur',function(){if(this.tooltip_message.getStyle('display')!='none'){this.tooltip_message.setStyle('display','none');}}.bind({error_message:error_message,tooltip_message:tooltip_message}));}},this);},getHomePageLayout:function(){var selected_layouts=$$('.reg-content-home .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=$('reg_content_prefill').checked?true:false;var form=$(document.SignUpForm);this.setFormField('Wizard__Name',form.elements["Wizard__Login"].value);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':'','login':'login','password':'password','name':'name','email':'email','design':'.reg .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=$$('.reg-error.'+elm_class);var placeholder=placeholders.length>0?placeholders[0]:$('signup_error');if(placeholder){placeholder.setStyle('display',err_str==""?'none':'block');placeholder.set('html','<p>'+err_str+'</p>');var label=$$('label[for='+elm_type+']');label=label.length>0?label[0]:null;if(label){if(err_str==""){label.removeClass('error');}else{label.addClass('error');}}}},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);}});


