(function(p){var q="string",w="head",L="body",M="script",u="readyState",j="preloaddone",x="loadtrigger",N="srcuri",E="preload",Z="complete",y="done",z="which",O="preserve",F="onreadystatechange",ba="onload",P="hasOwnProperty",bb="script/cache",Q="[object ",bw=Q+"Function]",bx=Q+"Array]",e=null,h=true,i=false,k=p.document,bc=p.location,bd=p.ActiveXObject,A=p.setTimeout,be=p.clearTimeout,R=function(a){return k.getElementsByTagName(a)},S=Object.prototype.toString,G=function(){},r={},T={},bf=/^[^?#]*\//.exec(bc.href)[0],bg=/^\w+\:\/\/\/?[^\/]+/.exec(bf)[0],by=R(M),bh=p.opera&&S.call(p.opera)==Q+"Opera]",bi=("MozAppearance"in k.documentElement.style),bj=(k.createElement(M).async===true),v={cache:!(bi||bh),order:bi||bh||bj,xhr:h,dupe:h,base:"",which:w};v[O]=i;v[E]=h;r[w]=k.head||R(w);r[L]=R(L);function B(a){return S.call(a)===bw}function U(a,b){var c=/^\w+\:\/\//,d;if(typeof a!=q)a="";if(typeof b!=q)b="";d=((/^\/\//.test(a))?bc.protocol:"")+a;d=(c.test(d)?"":b)+d;return((c.test(d)?"":(d.charAt(0)==="/"?bg:bf))+d)}function bz(a){return(U(a).indexOf(bg)===0)}function bA(a){var b,c=-1;while(b=by[++c]){if(typeof b.src==q&&a===U(b.src)&&b.type!==bb)return h}return i}function H(t,l){t=!(!t);if(l==e)l=v;var bk=i,C=t&&l[E],bl=C&&l.cache,I=C&&l.order,bm=C&&l.xhr,bB=l[O],bC=l.which,bD=l.base,bn=G,J=i,D,s=h,m={},K=[],V=e;C=bl||bm||I;function bo(a,b){if((a[u]&&a[u]!==Z&&a[u]!=="loaded")||b[y]){return i}a[ba]=a[F]=e;return h}function W(a,b,c){c=!(!c);if(!c&&!(bo(a,b)))return;b[y]=h;for(var d in m){if(m[P](d)&&!(m[d][y]))return}bk=h;bn()}function bp(a){if(B(a[x])){a[x]();a[x]=e}}function bE(a,b){if(!bo(a,b))return;b[j]=h;A(function(){r[b[z]].removeChild(a);bp(b)},0)}function bF(a,b){if(a[u]===4){a[F]=G;b[j]=h;A(function(){bp(b)},0)}}function X(b,c,d,g,f,n){var o=b[z];A(function(){if("item"in r[o]){if(!r[o][0]){A(arguments.callee,25);return}r[o]=r[o][0]}var a=k.createElement(M);if(typeof d==q)a.type=d;if(typeof g==q)a.charset=g;if(B(f)){a[ba]=a[F]=function(){f(a,b)};a.src=c;if(bj){a.async=i}}r[o].insertBefore(a,(o===w?r[o].firstChild:e));if(typeof n==q){a.text=n;W(a,b,h)}},0)}function bq(a,b,c,d){T[a[N]]=h;X(a,b,c,d,W)}function br(a,b,c,d){var g=arguments;if(s&&a[j]==e){a[j]=i;X(a,b,bb,d,bE)}else if(!s&&a[j]!=e&&!a[j]){a[x]=function(){br.apply(e,g)}}else if(!s){bq.apply(e,g)}}function bs(a,b,c,d){var g=arguments,f;if(s&&a[j]==e){a[j]=i;f=a.xhr=(bd?new bd("Microsoft.XMLHTTP"):new p.XMLHttpRequest());f[F]=function(){bF(f,a)};f.open("GET",b);f.send("")}else if(!s&&a[j]!=e&&!a[j]){a[x]=function(){bs.apply(e,g)}}else if(!s){T[a[N]]=h;X(a,b,c,d,e,a.xhr.responseText);a.xhr=e}}function bt(a){if(typeof a=="undefined"||!a)return;if(a.allowDup==e)a.allowDup=l.dupe;var b=a.src,c=a.type,d=a.charset,g=a.allowDup,f=U(b,bD),n,o=bz(f);if(typeof d!=q)d=e;g=!(!g);if(!g&&((T[f]!=e)||(s&&m[f])||bA(f))){if(m[f]!=e&&m[f][j]&&!m[f][y]&&o){W(e,m[f],h)}return}if(m[f]==e)m[f]={};n=m[f];if(n[z]==e)n[z]=bC;n[y]=i;n[N]=f;J=h;if(!I&&bm&&o)bs(n,f,c,d);else if(!I&&bl)br(n,f,c,d);else bq(n,f,c,d)}function Y(a){if(t&&!I)K.push(a);if(!t||C)a()}function bu(a){var b=[],c;for(c=-1;++c<a.length;){if(S.call(a[c])===bx)b=b.concat(bu(a[c]));else b[b.length]=a[c]}return b}D={script:function(){be(V);var a=bu(arguments),b=D,c;if(bB){for(c=-1;++c<a.length;){if(B(a[c]))a[c]=a[c]();if(c===0){Y(function(){bt((typeof a[0]==q)?{src:a[0]}:a[0])})}else b=b.script(a[c]);b=b.wait()}}else{for(c=-1;++c<a.length;){if(B(a[c]))a[c]=a[c]()}Y(function(){for(c=-1;++c<a.length;){bt((typeof a[c]==q)?{src:a[c]}:a[c])}})}V=A(function(){s=i},5);return b},wait:function(a){be(V);s=i;if(!B(a))a=G;var b=H(t||J,l),c=b.trigger,d=function(){try{a()}catch(err){}c()};delete b.trigger;var g=function(){if(J&&!bk)bn=d;else d()};if(t&&!J)K.push(g);else Y(g);return b}};if(t){D.trigger=function(){var a,b=-1;while(a=K[++b])a();K=[]}}else D.trigger=G;return D}function bv(a){var b,c={},d={"UseCachePreload":"cache","UseLocalXHR":"xhr","UsePreloading":E,"AlwaysPreserveOrder":O,"AllowDuplicates":"dupe"},g={"AppendTo":z,"BasePath":"base"};for(b in d)g[b]=d[b];c.order=!(!v.order);for(b in g){if(g[P](b)&&v[g[b]]!=e)c[g[b]]=(a[b]!=e)?a[b]:v[g[b]]}for(b in d){if(d[P](b))c[d[b]]=!(!c[d[b]])}if(!c[E])c.cache=c.order=c.xhr=i;c.which=(c.which===w||c.which===L)?c.which:w;return c}p.$LAB={setGlobalDefaults:function(a){v=bv(a)},setOptions:function(a){return H(i,bv(a))},script:function(){return H().script.apply(e,arguments)},wait:function(){return H().wait.apply(e,arguments)}};(function(a,b,c){if(k[u]==e&&k[a]){k[u]="loading";k[a](b,c=function(){k.removeEventListener(b,c,i);k[u]=Z},i)}})("addEventListener","DOMContentLoaded")})(window);

var sQuery = jQuery.noConflict(true);

// VERSION: 1.8 LAST UPDATE: 9.03.2011
/* 
 * Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
 * 
 * Made by Wilq32, wilq32@gmail.com, Wroclaw, Poland, 01.2009
 * Website: http://code.google.com/p/sQueryrotate/ 
 */
 (function(g){for(var d,j=document.getElementsByTagName("head")[0].style,h="transformProperty WebkitTransform OTransform msTransform MozTransform".split(" "),e=0;e<h.length;e++)j[h[e]]!==void 0&&(d=h[e]);var i="v"=="\v";sQuery.fn.extend({ImageRotate:function(a){if(!this.Wilq32||!this.Wilq32.PhotoEffect)return a=g.extend(!0,{},a),(new Wilq32.PhotoEffect(this.get(0),a))._rootObj},rotate:function(a){if(!(this.length===0||typeof a=="undefined")){typeof a=="number"&&(a={angle:a});for(var c=
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [],b=0,d=this.length;b<d;b++){var f=this.get(b);typeof f.Wilq32=="undefined"?c.push(g(g(f).ImageRotate(a))):f.Wilq32.PhotoEffect._handleRotation(a)}return c}}});Wilq32=window.Wilq32||{};Wilq32.PhotoEffect=function(){return d?function(a,c){a.Wilq32={PhotoEffect:this};this._img=this._rootObj=this._eventObj=a;this._handleRotation(c)}:function(a,c){this._img=a;this._rootObj=document.createElement("span");this._rootObj.style.display="inline-block";this._rootObj.Wilq32={PhotoEffect:this};a.parentNode.insertBefore(this._rootObj,
     a);if(a.complete)this._Loader(c);else{var b=this;sQuery(this._img).bind("load",function(){b._Loader(c)})}}}();Wilq32.PhotoEffect.prototype={_setupParameters:function(a){this._parameters=this._parameters||{};if(typeof this._angle!=="number")this._angle=0;if(typeof a.angle==="number")this._angle=a.angle;this._parameters.animateTo=typeof a.animateTo==="number"?a.animateTo:this._angle;this._parameters.easing=a.easing||this._parameters.easing||function(a,b,d,f,e){return-f*((b=b/e-1)*b*b*b-1)+d};this._parameters.duration=
     a.duration||this._parameters.duration||1E3;this._parameters.callback=a.callback||this._parameters.callback||function(){};a.bind&&a.bind!=this._parameters.bind&&this._BindEvents(a.bind)},_handleRotation:function(a){this._setupParameters(a);this._angle==this._parameters.animateTo?this._rotate(this._angle):this._animateStart()},_BindEvents:function(a){if(a&&this._eventObj){if(this._parameters.bind){var c=this._parameters.bind,b;for(b in c)c.hasOwnProperty(b)&&sQuery(this._eventObj).unbind(b,c[b])}this._parameters.bind=
         a;for(b in a)a.hasOwnProperty(b)&&sQuery(this._eventObj).bind(b,a[b])}},_Loader:function(){return i?function(a){var c=this._img.width,b=this._img.height;this._img.parentNode.removeChild(this._img);this._vimage=this.createVMLNode("image");this._vimage.src=this._img.src;this._vimage.style.height=b+"px";this._vimage.style.width=c+"px";this._vimage.style.position="absolute";this._vimage.style.top="0px";this._vimage.style.left="0px";this._container=this.createVMLNode("group");this._container.style.width=
         c;this._container.style.height=b;this._container.style.position="absolute";this._container.setAttribute("coordsize",c-1+","+(b-1));this._container.appendChild(this._vimage);this._rootObj.appendChild(this._container);this._rootObj.style.position="relative";this._rootObj.style.width=c+"px";this._rootObj.style.height=b+"px";this._rootObj.setAttribute("id",this._img.getAttribute("id"));this._rootObj.className=this._img.className;this._eventObj=this._rootObj;this._handleRotation(a)}:function(a){this._rootObj.setAttribute("id",
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   this._img.getAttribute("id"));this._rootObj.className=this._img.className;this._width=this._img.width;this._height=this._img.height;this._widthHalf=this._width/2;this._heightHalf=this._height/2;var c=Math.sqrt(this._height*this._height+this._width*this._width);this._widthAdd=c-this._width;this._heightAdd=c-this._height;this._widthAddHalf=this._widthAdd/2;this._heightAddHalf=this._heightAdd/2;this._img.parentNode.removeChild(this._img);this._aspectW=(parseInt(this._img.style.width,10)||this._width)/
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       this._img.width;this._aspectH=(parseInt(this._img.style.height,10)||this._height)/this._img.height;this._canvas=document.createElement("canvas");this._canvas.setAttribute("width",this._width);this._canvas.style.position="relative";this._canvas.style.left=-this._widthAddHalf+"px";this._canvas.style.top=-this._heightAddHalf+"px";this._canvas.Wilq32=this._rootObj.Wilq32;this._rootObj.appendChild(this._canvas);this._rootObj.style.width=this._width+"px";this._rootObj.style.height=this._height+"px";this._eventObj=
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           this._canvas;this._cnv=this._canvas.getContext("2d");this._handleRotation(a)}}(),_animateStart:function(){this._timer&&clearTimeout(this._timer);this._animateStartTime=+new Date;this._animateStartAngle=this._angle;this._animate()},_animate:function(){var a=+new Date,c=a-this._animateStartTime>this._parameters.duration;if(c&&!this._parameters.animatedGif)clearTimeout(this._timer);else{(this._canvas||this._vimage||this._img)&&this._rotate(~~(this._parameters.easing(0,a-this._animateStartTime,this._animateStartAngle,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               this._parameters.animateTo-this._animateStartAngle,this._parameters.duration)*10)/10);var b=this;this._timer=setTimeout(function(){b._animate.call(b)},10)}if(this._parameters.callback&&c)this._angle=this._parameters.animateTo,this._rotate(this._angle),this._parameters.callback.call(this._rootObj)},_rotate:function(){var a=Math.PI/180;return i?function(a){this._angle=a;this._container.style.rotation=a%360+"deg"}:d?function(a){this._angle=a;this._img.style[d]="rotate("+a%360+"deg)"}:function(c){this._angle=
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   c;c=c%360*a;this._canvas.width=this._width+this._widthAdd;this._canvas.height=this._height+this._heightAdd;this._cnv.translate(this._widthAddHalf,this._heightAddHalf);this._cnv.translate(this._widthHalf,this._heightHalf);this._cnv.rotate(c);this._cnv.translate(-this._widthHalf,-this._heightHalf);this._cnv.scale(this._aspectW,this._aspectH);this._cnv.drawImage(this._img,0,0)}}()};if(i)Wilq32.PhotoEffect.prototype.createVMLNode=function(){document.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               try{return!document.namespaces.rvml&&document.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),function(a){return document.createElement("<rvml:"+a+' class="rvml">')}}catch(a){return function(a){return document.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}}()})(sQuery);

sQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
expires='; expires='+date.toUTCString();}
var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=sQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
return cookieValue;}};

(function($) {

	$.fn.extend({
		center: function () {
	        return this.each(function() {
	                var top = ($(window).height() - $(this).outerHeight()) / 2;
	                var left = ($(window).width() - $(this).outerWidth()) / 2;
	                $(this).css({position:'absolute', margin:0, top: (top > 0 ? top : 0)+'px', left: (left > 0 ? left : 0)+'px'});
	        });
		}
	});

	document.write = function(str){
		$('body').append(str);
	}
	
	stiqr = {
		cred: '',
		curPage: "/",
		uri: "motomontage.com",
		data: {},
		elements: {},
		siteWidth: "1000",
		setCred: function(id,pass){
			this.cred = "/?SiteID="+id+"&Password="+pass+"&Page=/";
		},
		lazy: function(name, files, ret){
			var css = files.css;
			var js = files.js;
			var opts = {
				css: css,
				js: js,
				name: name,
				success: ret
			}
			$LAB
			.script("http://files.stiqr.com/resources/js/jquery/plugins/xLazyLoader/jquery.xLazyLoader.js")
			.wait(function(){
				$.xLazyLoader(opts);
			});
		},
		ui: {
			notifybar: function(opts){
				var position_css;
				var show = true;
				if(opts.position == undefined){
					opts.position = "bottom";
				}else{
					switch(opts.position){
						case "top":
							position_css = "top: 0;";
						break;
						
						case "bottom":
							position_css = "bottom: 0;";
						break;
					}
				}
				
				// show: once
				if(opts.show != undefined){
					switch(opts.show){
						case "once":
							var cookie_key = 'stiqrnotifybar1654';
							var cookie = $.cookie(cookie_key);
							if(!cookie){
								$.cookie(cookie_key, 1);
							}else{
								show = false;
							}
						break;
					}
				}
				if(show){
					$("<div class='stiqr-footer-overlay' style='text-align:center;background-color:#000000;color:white;width:100%;height:30px;position:fixed;"+position_css+"left:0;z-index:99999;display:none;padding-left:20px;padding-top:10px;border-top:1px solid #999999;'>"+opts.content+" <span style='position:absolute;right:50px;'><a href='http://www.stiqr.com' target='_blank'><img src='http://www.stiqr.com/images/ui/logo.stiqr.com.gif' style='border:0;'></a></span></div>").css({opacity:'0.8',fontSize:'12px',fontFamily:'arial',cursor:'pointer'}).appendTo('body').click(function(){ $(this).slideUp(); }).slideDown();
				}
			},
			modal: function(opts){
			
				// show: once
				var show = true;
				if(opts.show != undefined){
					switch(opts.show){
						case "once":
							var cookie_key = 'stiqrmodal1654';
							var cookie = $.cookie(cookie_key);
							if(!cookie){
								$.cookie(cookie_key, 1);
							}else{
								show = false;
							}
						break;
					}
				}
			
				if(show){
					stiqr.lazy('modal', {css: ['http://files.stiqr.com/resources/js/ui/modal/modal.css']}, function(r){
						var div_id = 'stiqr-lightbox-'+stiqr.ui.queueModal();
						var modal_id = 'stiqr-lightbox-modal-'+stiqr.ui.queueModal();
						var modal = '';
						var width = '80%';
						var height = '80%';
						if(opts.width != undefined) width = opts.width;
						if(opts.height != undefined) height = opts.height;
						
						switch (opts.mode) {
							
							default:
								modal += "<div id='"+div_id+"' class='stiqr-lightbox stiqr-modal' style='width:"+width+"; height: "+height+";'>";
								modal += "	<div class='stiqr-lightbox-box'>";
								if(opts.title != ''){
									modal += "		<div class='stiqr-lightbox-title'>"+opts.title+" <span class='stiqr-lightbox-title-close'><a href='#' class='stiqr-lightbox-close'>X</a></span></div>";
								}
								modal += "		<div class='stiqr-lightbox-content'>"+opts.content+"</div>";
								modal += "	</div>";
								modal += "</div>"
								$("<div id='"+modal_id+"' class='stiqr-lightbox-modal'></div>").appendTo('body');
								$(modal).appendTo('body');
								break;
								
							case 'iframe':
								var scrolling = 'auto';
								if(opts.scrolling != undefined) scrolling = opts.scrolling;
								modal += "<div id='"+div_id+"' class='stiqr-lightbox stiqr-modal' style='width:"+width+"; height: "+height+";'>";
								modal += "	<div class='stiqr-lightbox-box'>";
								if(opts.title != ''){
									modal += "		<div class='stiqr-lightbox-title'><!--<img src='http://www.stiqr.com/images/ui/logo.stiqr.com.gif' />--><span class='stiqr-lightbox-title-close'><a href='#' class='stiqr-lightbox-close'>X</a></span></div>";
								}
								modal += "		<div class='stiqr-lightbox-content'><iframe style='width:100%; height: 100%;' scrolling='"+scrolling+"' frameborder='0' src='"+opts.src+"'></iframe></div>";
								modal += "	</div>";
								modal += "</div>"
								$("<div id='"+modal_id+"' class='stiqr-lightbox-modal'></div>").appendTo('body');
								$(modal).appendTo('body');
							break;
						}
						
						$('#'+div_id).center();
						
						// animate upon show
						stiqr.ui.animateModal('#'+div_id);
						
						// register click events
						$('#'+div_id + ' .stiqr-lightbox-close').click(function(e){
							e.preventDefault();
							stiqr.ui.closeModal();
						});
						
						$('#'+modal_id).click(function(e){
							e.preventDefault();
							stiqr.ui.closeModal();
						});
					});
				}
			},
			queueModal: function(){
				$('.stiqr-modal').hide();
				return $('.stiqr-modal').length + 1;
			},
			closeModal: function(){
				var div_idx = $('.stiqr-modal').length;
				var div_id = 'stiqr-lightbox-'+ div_idx;
				var modal_id = 'stiqr-lightbox-modal-'+ div_idx;
				$('#'+div_id).remove();
				
				if(div_idx > 0){
					var div_prev = div_idx - 1;
					div_id = 'stiqr-lightbox-'+ div_prev;
					$('#'+div_id).show();
					stiqr.ui.animateModal('#'+div_id)
				}
				$('#'+modal_id).remove();
			},
			animateModal: function(target){
				// animate upon show
				$(target).animate({
					top: '-=10'
				}, 50, function() {
				   $(this).animate({
						top: '-=6'
				   }, 100, function(){
				   		$(this).animate({
							top: '+=3'
					   }, 100, function(){
					   		
					   });
				   });
				});
			}
		},
		getCred: function(){
			return this.cred;
		},
		getBrowserWidth: function(){
			return $(window).width();
		},
		notify: function(msg,title){
			/*
			var opts = {};
			opts.pnotify_text = msg;
			opts.pnotify_delay = 1000;
			opts.pnotify_history = false;
			if(title) opts.pnotify_title = title;
			$.pnotify(opts);
			*/
			$.jGrowl(msg);
		},
		serializeFormToObj: function(form){
			var data = {};
			$.each($(form).serializeArray(), function(i, o){
		        data[o.name] = o.value;
			});
			return data;
		},
		addStiqrArray: function(id,data){
		},		parseRel: function(sel){
			var id = $(sel).attr('id');
	        var options = $(sel).attr('rel');
	        var xOptions = options.split('|');
	        var attribs = {};
	        $.each(xOptions,function(k,v){
	        	var xOption = v.split('=');
	        	var name = xOption[0];
	        	var val = xOption[1];
	        	attribs[name] = val;
	        });
	        return attribs;
		},
		nl2br: function(str){
			return str.replace( /\n/g, '<br />\n' );
		},
		userInfo: {},
		validateEmail: function(email){
		   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		   var address = email;
		   if(reg.test(address) == false) {
		      alert('Invalid Email Address');
		      return false;
		   }else{
		   	  return true;
		   }
		},
		forgotPassword: function(){
			jPrompt('Enter an email address:', '', 'Forgot password', function(email) {
				if(stiqr.validateEmail(email)){
					stiqr.notify("verifying");
					$.post("http://pingram.stiqr.com/admin/forgot-password",{Email:email,Domain:'motomontage.com'},function(res){
						if(res == 'success'){
							stiqr.notify('password has been sent out to your email address');
						}else{
							stiqr.notify('sorry, your account was not found on our system '+res);
						}
					});
				}else{
					stiqr.forgotPassword();
				}
				
			});
		},
		registerEmail: function(){
			jPrompt('Enter your email address', '', 'Stiqr registration (step 1 of 2)', function(email) {
				if(stiqr.validateEmail(email)){
					stiqr.userInfo.Email = email;
			 		stiqr.registerPass();
				}else{
					stiqr.registerEmail();
				}
			});
		},
		registerPass: function(){
			jPromptPass('Choose a password for your account', '', 'Stiqr registration (step 2 of 2)', function(pw) {
	      		if(pw){
	      			stiqr.userInfo.Password = pw;
	      			stiqr.registerSubmit(stiqr.userInfo);
			    }
		    });
		},
		registerSubmit: function(data){
			$.post("http://pingram.stiqr.com/admin/site-register",{Password:data.Password,Domain:'motomontage.com',Email:data.Email},function(SiteID){
	      		alert('Thank you for registering with pingram.stiqr.com, your page will now refresh to activate your account. Once refreshed, Press shift+f2 again to login with your assigned password. Your email address was: '+data.Email);
	      		location.reload();
	      	});
		},
		registerAccount: function(){
			var email = stiqr.registerEmail();
			if(email){
				var pw = stiqr.registerPass();
				stiqr.registerSubmit({Email:email,Password:pw});
			}
		},
		browserHeight: $(document).height(),
		browserWidth: $(window).width(),
		align: 'center',
		initAdmin: function(){
			stiqr.notify("verify ok! now loading admin files ...");
			
			// admin initialize
			$LAB
			.script("http://pingram.stiqr.com/sticker/load-js/?userPage=/&userSite=motomontage.com&userSiteID=1654&time=1327759297")
			.wait()
			.script("http://files.stiqr.com/resources/js/jquery/plugins-admin.js")
			.wait(function(){
				$.xLazyLoader({
				    css: ['http://files.stiqr.com/resources/js/jquery/plugins/jqueryui/css/start/jquery-ui-1.7.1.full.css','http://files.stiqr.com/resources/js/jquery/plugins/colorpicker/css/colorpicker.css','http://files.stiqr.com/resources/js/jquery/plugins/cmenu/jquery.contextmenu.css','http://files.stiqr.com/resources/js/jquery/plugins/cke/_samples/sample.css','http://files.stiqr.com/resources/js/jquery/plugins/facebox/facebox.css','http://files.stiqr.com/resources/js/jquery/plugins/jeego/jeegoocontext/skins/cm_default/style.css'],
				    name: 'stiqrCssFiles',
				    success: function(){
				    	stiqr.settings = {
							Page: "/",
							Domain: "motomontage.com",
							SiteID: 1654						};
				    	stiqr.admin.drawAdmin();
				    	stiqr.admin.initAdmin();
				    	$('.stiqr-branding').hide();
				    					    }
				});
			});
		},
		drawCanvas: function(){
			$('body').append("<div id='stiqr-text-render' style='display:none;'></div>");
			$('head').append("<style>.stiqr-item-container a img,.stiqr-item-container a:hover img{border: 0;} .stiqr-unpublished{display:none;}.stiqr-published{display:block;}</style>");
		},
		drawSiteScripts: function(){
			
			$('.stiqr-rounded').livequery(function(){
				$(this).corner();
			});
			
			// init overlay modal
	    	$(".stiqr-overlay-trigger[rel]").overlay({ 
			    expose: { 
		        	loadSpeed: 100, 
		        	opacity: 0.5 
	    		}, 
			    closeOnClick:true
			});
			
			$.xLazyLoader({
			    css: ['http://files.stiqr.com/resources/js/jquery/plugins/alert/jquery.alerts.css','http://files.stiqr.com/resources/js/jquery/plugins/jgrowl/jquery.jgrowl.css','http://files.stiqr.com/resources/js/jquery/plugins/facebox/facebox.css','http://files.stiqr.com/resources/js/jquery/plugins/jqueryui/css/start/jquery-ui-1.7.1.full.css'],
			    name: 'stiqrPromptFiles',
			    success: function(){
			    	
			    }
			});
			
			
		},
		drawJs: function(){
					},
		drawCss: function(){
			$(head).append();
		},
		drawSite: function(json_url){
			// stickers
						var data = {"SiteStickerID":"60135","UserID":"0","SiteID":"1654","StickerID":"0","elId":"Page_Menu","Type":"SiteElement","Sticker":"","Path":"","Html":"","Text":"","Url":"","Dock":"center","Position":"absolute","PosTop":"77","PosLeft":"-451","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"0","isNewWindow":"0","isPopup":"0","isPublished":"1","isDynamicHeight":"0","Style":"","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"","Border":"","BorderWidth":"","BorderStyle":"","BorderColor":"","Opacity":"1","Font":"","FontSize":"","FontColor":"","FontStyle":"","Class":"","Dimension":"","Width":"343","Height":"31","Zindex":"2","App":"","AppSettings":"","Created":"2010-07-06 13:15:53","Modified":"2010-07-06 13:15:53","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"6","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['0'] = data;
						var data = {"SiteStickerID":"60136","UserID":"0","SiteID":"1654","StickerID":"0","elId":"Page_Menu","Type":"SiteElement","Sticker":"","Path":"","Html":"","Text":"","Url":"","Dock":"center","Position":"absolute","PosTop":"77","PosLeft":"-447","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"0","isNewWindow":"0","isPopup":"0","isPublished":"0","isDynamicHeight":"0","Style":"#Page_Menu {\n\n}","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"","Border":"","BorderWidth":"","BorderStyle":"","BorderColor":"","Opacity":"","Font":"","FontSize":"","FontColor":"","FontStyle":"","Class":"","Dimension":"","Width":"646","Height":"31","Zindex":"2","App":"","AppSettings":"","Created":"2010-07-06 13:16:31","Modified":"2010-07-06 13:16:31","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"6","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['1'] = data;
						var data = {"SiteStickerID":"62698","UserID":"0","SiteID":"1654","StickerID":"0","elId":"stiqr-id-62698","Type":"Background","Sticker":"","Path":"","Html":"<div id='stiqr-background' rel='62698'><style>body{  }<\/style><\/div>","Text":"","Url":"","Dock":"center","Position":"absolute","PosTop":"0","PosLeft":"0","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"0","isNewWindow":"0","isPopup":"0","isPublished":"1","isDynamicHeight":"0","Style":"","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"#1b1b19","Border":"","BorderWidth":"","BorderStyle":"","BorderColor":"","Opacity":"1","Font":"","FontSize":"","FontColor":"","FontStyle":"","Class":"","Dimension":"","Width":"","Height":"","Zindex":"1","App":"","AppSettings":"","Created":"2010-07-20 08:55:06","Modified":"2010-07-20 08:55:06","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"20","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['2'] = data;
						var data = {"SiteStickerID":"62699","UserID":"0","SiteID":"1654","StickerID":"0","elId":"stiqr-id-62699","Type":"Shape","Sticker":"","Path":"","Html":"","Text":"","Url":"","Dock":"center","Position":"absolute","PosTop":"74","PosLeft":"-470","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"1","isNewWindow":"0","isPopup":"0","isPublished":"1","isDynamicHeight":"0","Style":"#stiqr-id-62699 {\n\n}","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"#2c2d28","Border":"","BorderWidth":"","BorderStyle":"","BorderColor":"","Opacity":"","Font":"","FontSize":"","FontColor":"","FontStyle":"","Class":"","Dimension":"","Width":"940","Height":"700","Zindex":"1","App":"","AppSettings":"","Created":"2010-07-20 08:55:06","Modified":"2010-07-20 08:55:06","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"20","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['3'] = data;
						var data = {"SiteStickerID":"62700","UserID":"0","SiteID":"1654","StickerID":"0","elId":"stiqr-id-62700","Type":"Shape","Sticker":"","Path":"","Html":"","Text":"","Url":"","Dock":"center","Position":"absolute","PosTop":"112","PosLeft":"-470","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"0","isNewWindow":"0","isPopup":"0","isPublished":"1","isDynamicHeight":"0","Style":"#stiqr-id-62700 {\n\n}","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"#232320","Border":"","BorderWidth":"","BorderStyle":"","BorderColor":"","Opacity":"","Font":"","FontSize":"","FontColor":"","FontStyle":"","Class":"","Dimension":"","Width":"940","Height":"366","Zindex":"1","App":"","AppSettings":"","Created":"2010-07-20 08:55:06","Modified":"2010-07-20 08:55:06","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"20","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['4'] = data;
						var data = {"SiteStickerID":"62701","UserID":"0","SiteID":"1654","StickerID":"14830","elId":"stiqr-id-62701","Type":"Image","Sticker":"","Path":"\/public\/images\/62701.jpg","Html":"","Text":"","Url":"","Dock":"center","Position":"absolute","PosTop":"4","PosLeft":"-465","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"0","isNewWindow":"0","isPopup":"0","isPublished":"1","isDynamicHeight":"0","Style":"","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"","Border":"","BorderWidth":"","BorderStyle":"","BorderColor":"","Opacity":"1","Font":"","FontSize":"","FontColor":"","FontStyle":"","Class":"","Dimension":"","Width":"245","Height":"65","Zindex":"1","App":"","AppSettings":"","Created":"2010-07-20 08:55:06","Modified":"2010-07-30 13:54:09","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"20","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['5'] = data;
						var data = {"SiteStickerID":"62702","UserID":"0","SiteID":"1654","StickerID":"14831","elId":"stiqr-id-62702","Type":"Image","Sticker":"","Path":"\/public\/images\/62702.jpg","Html":"","Text":"","Url":"","Dock":"center","Position":"absolute","PosTop":"132","PosLeft":"-451","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"0","isNewWindow":"0","isPopup":"0","isPublished":"1","isDynamicHeight":"0","Style":"#stiqr-id-62702 {\n\n}","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"","Border":"","BorderWidth":"","BorderStyle":"","BorderColor":"","Opacity":"1","Font":"","FontSize":"","FontColor":"","FontStyle":"","Class":"","Dimension":"","Width":"585","Height":"312","Zindex":"1","App":"","AppSettings":"","Created":"2010-07-20 08:55:06","Modified":"2010-07-20 08:55:06","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"20","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['6'] = data;
						var data = {"SiteStickerID":"62703","UserID":"0","SiteID":"1654","StickerID":"14832","elId":"stiqr-id-62703","Type":"Image","Sticker":"","Path":"\/public\/images\/62703.jpg","Html":"","Text":"","Url":"","Dock":"center","Position":"absolute","PosTop":"132","PosLeft":"175","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"0","isNewWindow":"0","isPopup":"0","isPublished":"1","isDynamicHeight":"0","Style":"#stiqr-id-62703 {\n\n}","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"","Border":"","BorderWidth":"","BorderStyle":"","BorderColor":"","Opacity":"1","Font":"","FontSize":"","FontColor":"","FontStyle":"","Class":"","Dimension":"","Width":"273","Height":"312","Zindex":"1","App":"","AppSettings":"","Created":"2010-07-20 08:55:06","Modified":"2010-07-20 08:55:06","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"20","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['7'] = data;
						var data = {"SiteStickerID":"62704","UserID":"0","SiteID":"1654","StickerID":"0","elId":"stiqr-id-62704","Type":"Shape","Sticker":"","Path":"","Html":"","Text":"","Url":"","Dock":"center","Position":"absolute","PosTop":"662","PosLeft":"-470","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"0","isNewWindow":"0","isPopup":"0","isPublished":"1","isDynamicHeight":"0","Style":"#stiqr-id-62704 {\n\n}","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"#1b1b19","Border":"","BorderWidth":"","BorderStyle":"","BorderColor":"","Opacity":"","Font":"","FontSize":"","FontColor":"","FontStyle":"","Class":"","Dimension":"","Width":"940","Height":"2","Zindex":"1","App":"","AppSettings":"","Created":"2010-07-20 08:55:06","Modified":"2010-07-20 08:55:06","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"20","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['8'] = data;
						var data = {"SiteStickerID":"62705","UserID":"0","SiteID":"1654","StickerID":"0","elId":"stiqr-id-62705","Type":"Shape","Sticker":"","Path":"","Html":"","Text":"","Url":"","Dock":"center","Position":"absolute","PosTop":"744","PosLeft":"-470","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"0","isNewWindow":"0","isPopup":"0","isPublished":"1","isDynamicHeight":"0","Style":"#stiqr-id-62705 {\n\n}","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"#1b1b19","Border":"","BorderWidth":"","BorderStyle":"","BorderColor":"","Opacity":"","Font":"","FontSize":"","FontColor":"","FontStyle":"","Class":"","Dimension":"","Width":"940","Height":"2","Zindex":"1","App":"","AppSettings":"","Created":"2010-07-20 08:55:06","Modified":"2010-07-20 08:55:06","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"20","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['9'] = data;
						var data = {"SiteStickerID":"62706","UserID":"0","SiteID":"1654","StickerID":"14838","elId":"stiqr-id-62706","Type":"Image","Sticker":"","Path":"\/public\/images\/62706.jpg","Html":"","Text":"","Url":"","Dock":"center","Position":"absolute","PosTop":"499","PosLeft":"240","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"0","isNewWindow":"0","isPopup":"0","isPublished":"1","isDynamicHeight":"0","Style":"","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"","Border":"","BorderWidth":"","BorderStyle":"","BorderColor":"","Opacity":"1","Font":"","FontSize":"","FontColor":"","FontStyle":"","Class":"","Dimension":"","Width":"204","Height":"144","Zindex":"1","App":"","AppSettings":"","Created":"2010-07-20 08:55:06","Modified":"2010-07-20 08:55:06","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"20","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['10'] = data;
						var data = {"SiteStickerID":"62707","UserID":"0","SiteID":"1654","StickerID":"14837","elId":"stiqr-id-62707","Type":"Image","Sticker":"","Path":"\/public\/images\/62707.gif","Html":"","Text":"","Url":"http:\/\/www.raceprovenmotorsports.com","Dock":"center","Position":"absolute","PosTop":"673","PosLeft":"-117","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"0","isNewWindow":"1","isPopup":"0","isPublished":"1","isDynamicHeight":"0","Style":"#stiqr-id-62707 {\n\n}","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"","Border":"","BorderWidth":"2px","BorderStyle":"","BorderColor":"#535233","Opacity":"","Font":"","FontSize":"","FontColor":"","FontStyle":"","Class":"","Dimension":"","Width":"234","Height":"60","Zindex":"1","App":"","AppSettings":"","Created":"2010-07-20 08:55:06","Modified":"2010-07-20 08:55:06","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"20","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['11'] = data;
						var data = {"SiteStickerID":"62708","UserID":"0","SiteID":"1654","StickerID":"14836","elId":"stiqr-id-62708","Type":"Image","Sticker":"","Path":"\/public\/images\/62708.gif","Html":"","Text":"","Url":"http:\/\/www.ocpools.net","Dock":"center","Position":"absolute","PosTop":"673","PosLeft":"177","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"0","isNewWindow":"1","isPopup":"0","isPublished":"1","isDynamicHeight":"0","Style":"#stiqr-id-62708 {\n\n}","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"","Border":"","BorderWidth":"2px","BorderStyle":"","BorderColor":"#535233","Opacity":"","Font":"","FontSize":"","FontColor":"","FontStyle":"","Class":"","Dimension":"","Width":"234","Height":"60","Zindex":"1","App":"","AppSettings":"","Created":"2010-07-20 08:55:06","Modified":"2010-07-20 08:55:06","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"20","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['12'] = data;
						var data = {"SiteStickerID":"62709","UserID":"0","SiteID":"1654","StickerID":"14835","elId":"stiqr-id-62709","Type":"Image","Sticker":"","Path":"\/public\/images\/62709.gif","Html":"","Text":"","Url":"http:\/\/www.factorygraphx.com","Dock":"center","Position":"absolute","PosTop":"673","PosLeft":"-411","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"0","isNewWindow":"1","isPopup":"0","isPublished":"1","isDynamicHeight":"0","Style":"#stiqr-id-62709 {\n\n}","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"","Border":"","BorderWidth":"2px","BorderStyle":"","BorderColor":"#535233","Opacity":"","Font":"","FontSize":"","FontColor":"","FontStyle":"","Class":"","Dimension":"","Width":"234","Height":"60","Zindex":"1","App":"","AppSettings":"","Created":"2010-07-20 08:55:06","Modified":"2010-07-20 08:55:06","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"20","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['13'] = data;
						var data = {"SiteStickerID":"62710","UserID":"0","SiteID":"1654","StickerID":"14834","elId":"stiqr-id-62710","Type":"Image","Sticker":"","Path":"\/public\/images\/62710.jpg","Html":"","Text":"","Url":"http:\/\/twitter\/com\/motomontage","Dock":"center","Position":"absolute","PosTop":"5","PosLeft":"238","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"0","isNewWindow":"1","isPopup":"0","isPublished":"1","isDynamicHeight":"0","Style":"#stiqr-id-62710 {\n\n}","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"","Border":"","BorderWidth":"","BorderStyle":"","BorderColor":"","Opacity":"1","Font":"","FontSize":"","FontColor":"","FontStyle":"","Class":"","Dimension":"","Width":"220","Height":"65","Zindex":"1","App":"","AppSettings":"","Created":"2010-07-20 08:55:06","Modified":"2010-07-30 13:54:09","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"20","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['14'] = data;
						var data = {"SiteStickerID":"62712","UserID":"0","SiteID":"1654","StickerID":"0","elId":"stiqr-id-62712","Type":"Text","Sticker":"","Path":"","Html":"<div class=\"stiqr-text-content\" style=\"font-family: Arial; font-size: 14px; color: rgb(186, 186, 185); \">All of our photographers are experienced riders and love everything involving wheels and dirt.  We\u2019ll meet up with you at your favorite SoCal track and personally work with you and your riding capabilities to expose your greatest potential and capture it all on film.<br>\n<br>\nWhen finished, we\u2019ll review the photos with you on a laptop and burn the cd right then and there!<\/div>","Text":"<div class=\"stiqr-text-content\" style=\"font-family: Arial; font-size: 14px; color: rgb(186, 186, 185); \">All of our photographers are experienced riders and love everything involving wheels and dirt.  We\u2019ll meet up with you at your favorite SoCal track and personally work with you and your riding capabilities to expose your greatest potential and capture it all on film.<br>\n<br>\nWhen finished, we\u2019ll review the photos with you on a laptop and burn the cd right then and there!<\/div>","Url":"","Dock":"center","Position":"absolute","PosTop":"502","PosLeft":"-171","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"0","isNewWindow":"0","isPopup":"0","isPublished":"1","isDynamicHeight":"0","Style":"#stiqr-id-62712 {\n\n}","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"","Border":"","BorderWidth":"","BorderStyle":"","BorderColor":"","Opacity":"1","Font":"Arial","FontSize":"14","FontColor":"ffffff","FontStyle":"","Class":"","Dimension":"","Width":"386","Height":"136","Zindex":"1","App":"","AppSettings":"","Created":"2010-07-20 08:55:06","Modified":"2010-07-20 08:55:06","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"20","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['15'] = data;
						var data = {"SiteStickerID":"62713","UserID":"0","SiteID":"1654","StickerID":"0","elId":"stiqr-id-62713","Type":"Text","Sticker":"","Path":"","Html":"<div class=\"stiqr-text-content\" style=\"font-family: Arial; font-size: 10px; color: rgb(186, 186, 185); \">\u00a9 2010 motomontage.    All rights reserved.<\/div>","Text":"<div class=\"stiqr-text-content\" style=\"font-family: Arial; font-size: 10px; color: rgb(186, 186, 185); \">\u00a9 2010 motomontage.    All rights reserved.<\/div>","Url":"","Dock":"center","Position":"absolute","PosTop":"753","PosLeft":"-95","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"0","isNewWindow":"0","isPopup":"0","isPublished":"1","isDynamicHeight":"0","Style":"#stiqr-id-62713 {\n\n}","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"","Border":"","BorderWidth":"","BorderStyle":"","BorderColor":"","Opacity":"1","Font":"Arial","FontSize":"10","FontColor":"ffffff","FontStyle":"","Class":"","Dimension":"","Width":"195","Height":"13","Zindex":"1","App":"","AppSettings":"","Created":"2010-07-20 08:55:06","Modified":"2010-07-30 13:54:09","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"20","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['16'] = data;
						var data = {"SiteStickerID":"62714","UserID":"0","SiteID":"1654","StickerID":"0","elId":"stiqr-id-62714","Type":"Html","Sticker":"","Path":"","Html":"<p style=\"margin:5px;font-size: 14px;text-indent: 35px;line-height: 28px;background: url(..\/images\/bullet.jpg) no-repeat top left;background-position: 5px;\"><a href=\"http:\/\/phil.motomontage.com\/\"><strong>View a live demo of a custom site<\/strong><\/a><\/p> \n<p style=\"margin:5px;font-size: 14px;text-indent: 35px;line-height: 28px;background: url(..\/images\/bullet.jpg) no-repeat top left;background-position: 5px;\"><a href=\"http:\/\/motomontage.com\/about\/\"><strong>Check out all our great features<\/strong><\/a><\/p> \n<p style=\"margin:5px;font-size: 14px;text-indent: 35px;line-height: 28px;background: url(..\/images\/bullet.jpg) no-repeat top left;background-position: 5px;\"><a href=\"#\"><strong>View our SoCal track schedule<\/strong><\/a><\/p> \n<p style=\"margin:5px;font-size: 14px;text-indent: 35px;line-height: 28px;background: url(..\/images\/bullet.jpg) no-repeat top left;background-position: 5px;\"><a href=\"#\"><strong>Visit motoMontage online store<\/strong><\/a><\/p>","Text":"","Url":"","Dock":"center","Position":"absolute","PosTop":"497","PosLeft":"-460","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"0","isNewWindow":"0","isPopup":"0","isPublished":"1","isDynamicHeight":"0","Style":"#stiqr-id-62714 {\n\n}","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"","Border":"","BorderWidth":"","BorderStyle":"","BorderColor":"","Opacity":"1","Font":"","FontSize":"","FontColor":"","FontStyle":"","Class":"","Dimension":"","Width":"276","Height":"147","Zindex":"1","App":"","AppSettings":"","Created":"2010-07-20 08:55:07","Modified":"2010-07-30 13:54:09","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"20","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['17'] = data;
						var data = {"SiteStickerID":"62717","UserID":"0","SiteID":"1654","StickerID":"0","elId":"Page_Menu","Type":"SiteElement","Sticker":"","Path":"","Html":"","Text":"","Url":"","Dock":"center","Position":"absolute","PosTop":"77","PosLeft":"-447","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"0","isNewWindow":"0","isPopup":"0","isPublished":"1","isDynamicHeight":"0","Style":"#Page_Menu {\n\n}","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"","Border":"","BorderWidth":"","BorderStyle":"","BorderColor":"","Opacity":"","Font":"","FontSize":"","FontColor":"","FontStyle":"","Class":"","Dimension":"","Width":"646","Height":"31","Zindex":"2","App":"","AppSettings":"","Created":"2010-07-06 13:16:31","Modified":"2010-07-20 08:55:16","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"6","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['18'] = data;
						var data = {"SiteStickerID":"63946","UserID":"0","SiteID":"1654","StickerID":"0","elId":"Search_Form","Type":"SiteElement","Sticker":"","Path":"","Html":"","Text":"","Url":"","Dock":"center","Position":"absolute","PosTop":"81","PosLeft":"238","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"0","isNewWindow":"0","isPopup":"0","isPublished":"0","isDynamicHeight":"0","Style":"#Search_Form {\n\n}","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"","Border":"","BorderWidth":"","BorderStyle":"","BorderColor":"","Opacity":"1","Font":"","FontSize":"","FontColor":"","FontStyle":"","Class":"","Dimension":"","Width":"226","Height":"30","Zindex":"2","App":"","AppSettings":"","Created":"2010-07-30 13:35:55","Modified":"2010-07-30 13:35:55","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"30","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['19'] = data;
						var data = {"SiteStickerID":"63947","UserID":"0","SiteID":"1654","StickerID":"0","elId":"Search_Form","Type":"SiteElement","Sticker":"","Path":"","Html":"","Text":"","Url":"","Dock":"center","Position":"absolute","PosTop":"81","PosLeft":"238","PosRight":"0","PosBottom":"0","Page":"\/","AppendTo":"","isGlobal":"0","isRounded":"0","isNewWindow":"0","isPopup":"0","isPublished":"1","isDynamicHeight":"0","Style":"#Search_Form {\n\n}","BackgroundImage":"","BackgroundPosition":"","BackgroundAttachment":"","BackgroundRepeat":"","BackgroundColor":"","Border":"","BorderWidth":"","BorderStyle":"","BorderColor":"","Opacity":"1","Font":"","FontSize":"","FontColor":"","FontStyle":"","Class":"","Dimension":"","Width":"226","Height":"30","Zindex":"2","App":"","AppSettings":"","Created":"2010-07-30 13:36:09","Modified":"2010-07-30 13:36:09","Active":"1","Name":"","Description":"","Js":"","Title":"","Rel":"","PlaceBelow":"","TimerStart":"0","TimerStop":"0","Rotate":"0","TemplateID":"0","Padding":"","CreatedMonth":"Jul","CreatedDay":"30","CreatedYear":"2010","Align":"center","isSiteElement":0};
						stiqr.elements['20'] = data;
						stiqr.drawFromData(stiqr.elements);
			stiqr.exportData = stiqr.elements;
		},
		drawFonts: function(){
			$('<link />').attr({
				'rel':'stylesheet',
				'type':'text/css',
				'href':'http://fonts.googleapis.com/css?family=Arial'
			}).appendTo('head');
		},
		drawSiteFromFile: function(url){
			$.get(url, function(res){
				stiqr.drawFromData(JSON.parse(res));
			});
		},
		"export": function(){
			if(stiqr.exportData != undefined){
				var json = JSON.stringify(stiqr.exportData);
				sQuery.facebox(json);
			}
		},
		drawFromData: function(data){
			$.each(data,function(key,element){
				stiqr.save(element);
			});
		},
		getModifiedElements: function(){
			return this.modifiedElements;
		},
		modifiedElements: {},
		modified: function(elId,data){
			var changedData = {};
			if(data){
				changedData = data;
			}
			changedData.modified = true;
			this.modifiedElements[elId] = changedData;
			$('#stiqr-interface-save').show();
		},
		unmodifyAll: function(){
			this.modifiedElements = {};
			$('#stiqr-interface-save').hide();
		},
		get: function(elId){
			// if all numbers, it's SiteStickerID
			if (/^\d*$/.test(elId)){
				elId = 'stiqr-id-'+elId;
			}
			return stiqr.data[elId];
		},
		update: function(elId,data){
			var el = stiqr.get(elId);
			$.each(data,function(k,v){
				el[k] = v;
			});
			this.data[elId] = el;
			this.modified(elId,data);
		},
		saveCanvas: function(){
			var elements = this.getModifiedElements();
			var postData = {};
			
			$.each(elements,function(k,v){
				var data = stiqr.get(k);
				if(data.elId && data.SiteStickerID == undefined){
					data.SiteStickerID = data.elId;
				}
				postData[data.SiteStickerID] = data;
			});
			
			postData = JSON.stringify(postData);
			stiqr.notify("Saving ...");
			$('#stiqr-interface-save').hide();
			$.post("http://pingram.stiqr.com/admin/site-sticker-save-page"+ stiqr.getCred(),{data:postData},function(res){  
			    if(stiqr.cred){
				    stiqr.notify("all saved");
					if(res){
						var resp = JSON.parse(res);
						switch(resp.Type){
							case "New Sticker Saved":
								$.each(resp.Data,function(k,v){
									var newData = stiqr.data[v.OldEl];
									newData.SiteStickerID = v.NewID;
									newData.isNew = 0;
									$('#'+v.OldEl).attr('id',v.NewEl);
									stiqr.data[v.NewEl] =  stiqr.data[v.OldEl];
									stiqr.data[v.NewEl].elId = v.NewEl;
									stiqr.data[v.NewEl].SiteStickerID = newData.SiteStickerID;
									stiqr.data[v.NewEl].Type = newData.Type;
									stiqr.data[v.NewEl].Style = v.Style;
									stiqr.data[v.NewEl].Js = v.Js;
									delete(stiqr.data[v.OldEl]);
								});
							break;
						}
					}
				}else{
				   stiqr.notify("demonstration only"); return;
				}
				stiqr.unmodifyAll();
				if(stiqrExport != undefined){
					stiqrExport();
				}
			});
		},
		place: function(data){
			var $el = $('#'+data.elId);
			if(data.isDynamicHeight == 1){
				$el.css('min-height',data.Height+'px');
				$el.css('height',''); // let min-height do it's magic
			}
			switch(data.Dock){
				default:
					var PosTop = data.PosTop;
					if(data.PosLeft != undefined){
						if(data.AppendTo != '' && $el.parent().css('width')!='100%'){
							$el.css({top:data.PosTop+'px',left:data.PosLeft+'px'});
						}else{
							if(data.isUpdated == 1){
								var PosLeft = (stiqr.origWidth/2) + parseInt(data.PosLeft);
								//$el.css({top:data.PosTop+'px',left:PosLeft+'px'});
							}else{
								var test = 0;
								if(test == 0){
									switch(stiqr.align){
										default:
											var PosLeft = (stiqr.getBrowserWidth()/2) + parseInt(data.PosLeft);
											break;
										
										case "left":
											var PosLeft = data.PosLeft;
											break;
									}
									if(data.Position){
									}else{
										data.Position = 'absolute';
									}
								}else{
									//$el.css({position:data.Position,margin:'0 auto',left:data.PosLeft+'px',top:data.PosTop+'px'});
								}	
								
								if(data.isNew==1 && data.isTemplate!=1){
									$el.css({position:'absolute',top:data.PosTop+'px',left:data.PosLeft+'px'});
								}else{
									$el.css({top:data.PosTop+'px',left:PosLeft+'px'});
								}
							}
						}
					}
	
				break;
			
				case "left":
					$el.css('left','0px');
					$el.css('top',data.PosTop+'px');
					$el.css('right','');
				break;
				
				case "right":
					$el.css('right','0px');
					$el.css('top',data.PosTop+'px');
					$el.css('left','');
				break;
				
				case "bottom":
					$el.css('bottom','0px');
					$el.css('left',data.PosLeft+'px');
					$el.css('top','');
				break;
			}
		},
		save: function(data){
						
			var stiqrData = {};
			stiqrData.Dock = 'center';
			if(data.elId){ // if through selector
				var elId = data.elId;
			}else{ // if through SiteStickerID/SiteElementID
				if(data.SiteStickerID){
					var elId = 'stiqr-id-' + data.SiteStickerID;
					data.elId = elId;
				}else{
					var count = 1;
					$.each(stiqr.data,function(k,v){
						count = count + 1;
					});
					var elId = 'stiqr-new-id-'+count;
					data.elId = elId;
					data.SiteStickerID = elId;
					data.isNew = 1;
					id = 'new';
					if(data.Position){
					}else{
						data.Position = 'absolute';
					}
				}
			}
			
			$.each(data, function(k,v){
				if(k == "BackgroundColor" && v != ''){
					v = v.replace('#','');
				}
				if(k == "BorderColor" && v != ''){
					v = v.replace('#','');
				}
				if(k == "BorderWidth" && v != ''){
					if(v.indexOf("px") == 1){
					}else{
						v = v + 'px';
					}
				}
				stiqrData[k] = v;
			});
			
			
			if(stiqrData.Type == 'Text'){
				stiqrData.Text = stiqrData.Html;
				if(data.isNew == 1 && data.isTemplate != 1){
					if(data.isUpdated != 1){
						stiqrData.Html = stiqr.nl2br(stiqrData.Html);
						$("#stiqr-text-render").html('');
						$("#stiqr-text-render").html("<div class='stiqr-text-content'>" + stiqrData.Html + "</div>");
					}else{
						$("#stiqr-text-render").html(stiqrData.Html);
					}
					if(stiqrData.Font != ''){ 
						$("#stiqr-text-render .stiqr-text-content").css({fontFamily:stiqrData.Font,fontSize:stiqrData.FontSize+'px',color:'#'+stiqrData.FontColor});
					}
					stiqrData.Html = $("#stiqr-text-render").html();
				}
			}
			
			if(stiqrData.Type == "Background"){
				//stiqrData.PosLeft = "999999";
			}
			
			if(data.isDupe == 1){
				stiqrData.Text = data.Text;
				stiqrData.Html = data.Html;
			}
			
			if(data.Page == '' || data.Page == undefined){
				stiqrData.Page = stiqr.curPage;
			}
			
			if(data.AppendTo == undefined){
				stiqrData.AppendTo = '';
			}
			
			if(data.PlaceBelow == undefined){
				stiqrData.PlaceBelow = '';
			}
			
			if(stiqrData.Js == undefined) stiqrData.Js = '';
			if(stiqrData.Style == undefined) stiqrData.Style = '';
			
			if(data.isTemplate){
				stiqrData.isTemplate = 1;
				stiqrData.Js = stiqrData.Js.replace(/stiqr-id-\d+/gi,stiqrData.elId);
				stiqrData.Style = stiqrData.Style.replace(/stiqr-id-\d+/gi,stiqrData.elId);
				if(data.Type=='Apps'){
					stiqrData.App = data.App;
					stiqrData.appObject = eval('(' + data.App + ')');
					stiqrData.AppSettings = data.AppSettings;
					stiqrData.isApp = 1;
				}
			}
			
			if(data.isUpdated || data.isNew || data.isTemplate){
				stiqr.modified(elId,data);
			}

			this.data[elId] = stiqrData;
			this.stiq(elId);
			return elId;
		},
		stiq: function(elId){
			var data = stiqr.get(elId);
			var appendTo = 'body';
			if($('#'+elId).length == 0){
				if(data.AppendTo){
					appendTo = data.AppendTo;
				}
				$(appendTo).append("<div id='"+elId+"' class='stiqr-resizable stiqr-item-container'></div>");
			}
			
			var $el = $('#'+elId);
			
			var html = "";
			
			switch(data.Type){
				case "Apps":
					$el.html('');
				break;
				
				case "Text":
					if(data.Html){
						$el.html(data.Html);
					}
				break;
				
				case "Image":
					if(data.isUpdated){
						
					}else{
						if(data.Path){
                            var newWindow = ''; var overlay = '';
                            var html = "<img width='100%' height='100%' border='0' src='http://files.stiqr.com"+data.Path+"'>";
                            var imgpath = data.Path;

                            var match = imgpath.search(/^http/);
						    var dim_stretch = "";
						    if(data.Width != 0){
								dim_stretch = "width='100%' height='100%'";   
						    }

                            if(match){
                                    var html = "<img "+dim_stretch+" border='0' src='http://files.stiqr.com"+data.Path+"'>";
                            }else{
                                    var html = "<img "+dim_stretch+" border='0' src='"+data.Path+"'>";
                            }
                            $el.html(html);
			    

						    if(dim_stretch == ''){
						        data.Width = $el.find('img').width();
						        data.Height = $el.find('img').height();
								$el.find('img').css({width:'100%',height:'100%'});
						    }
                            
                            if(data.AppendTo){
                            	//alert(imgpath);
                            }
                        }

					}
				break;
				
				case "Shape":
					$el.css('border','0px solid');
					if(data.Html){
						$el.html("<div class='stiqr-item-shape'>"+data.Html+"</div>");
					}
				break;
				
				case "Background":
					if(data.Html){
						$el.html(data.Html);
					}
					if(data.BackgroundAttachment) $('body').css('background-attachment', data.BackgroundAttachment);
					if(data.BackgroundColor){ 
						$('body').css('background-color', '#'+data.BackgroundColor);
					}
					if(data.BackgroundImage) $('body').css('background-image', 'url('+data.BackgroundImage+')');
					if(data.BackgroundPosition) $('body').css('background-position', data.BackgroundPosition);
					if(data.BackgroundRepeat) $('body').css('background-repeat', data.BackgroundRepeat);

				break;
				
				case "Html":
					if(data.Html){
						$el.html(data.Html);
					}
				break;
				
			}
			
				
			$.each(data,function(k,v){
				var html = "";
				
				switch(k){
					case "Url":
						if(v){
							$el.html("<a href='"+data.Url+"'>" + $el.html() + "</a>");
							if(data.FontColor){
								$el.find('a').css('color','#'+data.FontColor);
							}
							if(v.charAt(0)=='#'){
								$el.find('a').attr('href',"javascript:void(0);").attr('rel',data.Url).addClass('stiqr-overlay-trigger');
							}else{
								$el.find('a').removeClass('stiqr-overlay-trigger').attr('href',data.Url).attr('rel','');
								if(data.isNewWindow == 1){
									$el.find('a').attr('target','_blank');
								}else{
									$el.find('a').attr('target','_self');
								}
							}
						}
					break;
					
					case "Width":
						if(v){
							v = v+""; // convert to string
							if(v.indexOf("px")>0){
								$el.css('width',v);
							}else if(v.indexOf("%")>0){
								if(v == "100%"){
									$el.css({left:0,margin:0});
								}
								$el.css('width',v);
							}else{
								$el.css('width',v+'px');
							}
						}
					break;
					
					case "Height":
						if(v){
							v = v+""; // convert to string
							if(v.indexOf("px")>0){
								$el.css('height',v);
							}else if(v.indexOf("%")>0){
								if(v == "100%"){
									$el.css({top:0,margin:0,height:$(document).height()});
								}else{
									$el.css('height',v);
								}
							}else{
								$el.css('height',v+'px');
							}
						}
					break;
					
					case "BackgroundColor":
						if(v){
							$el.css('backgroundColor','#'+v);
						}else{
							$el.css('backgroundColor','transparent');
						}
					break;
					
					case "isRounded":
						if(v == 1 || v == true){
							$el.addClass('stiqr-rounded');
						}
					break;
					
					case "Rotate":
						if(v!='0'){
							$el.rotate(parseInt(v));
						}
					break;
					
					case "Padding":
						if(v!=''){
							$el.css('padding', v);
						}
					break;
					
					case "isGlobal":
						
					break;
					
					case "isPublished":
						$el.removeClass('stiqr-unpublished');
						if(v != 1){
							$el.addClass('stiqr-unpublished');
						}
					break;
					
					case "BorderWidth":
						if(v){ 
							$el.css('borderWidth',v);
							if(data.BorderColor) {
								$el.css('border-color','#'+data.BorderColor);
							}
							if(data.BorderStyle){ 
								$el.css('border-style',data.BorderStyle);
							}else{
								$el.css('border-style','solid');
							}
						}
					break;
					
					case "Opacity":
						if(v && v!=1){
							$el.css('opacity',v);
						}
					break;
					
					case "Class":
						if(v){ 
							$el.addClass(v);
							$el.data('myClass',v);
						}else{
							var myClass = $el.data('myClass');
							if(myClass != '' && myClass != undefined){
								$el.removeClass(myClass);
							}
						}
					break;	
					
					case "Zindex":
						if(v) $el.css('zIndex',v);
					break;
					
					case "Position":
						if(v) $el.css('position',v);
					break;
					
					case "Dock":
						stiqr.place(data);
					break;
				}
					
			});
		
			if(data.isTemplate){
				var PosLeft = (stiqr.getBrowserWidth()/2) + parseInt(data.PosLeft);
				//$el.css({position:data.Position,top:data.PosTop+'px',left:PosLeft+'px'});
			}
			
			if(data.isNew==1){
				if(data.Type != 'Background'){
					data.Width = $el.css('width');
					data.Height = $el.css('height');
					
					if(data.Width != undefined){
						data.Width = data.Width.replace('px','');
						data.Height = data.Height.replace('px','');				
					}
				}
			}
			
			
			if(data.isRounded==1 && typeof(data.BorderWidth)!='undefined'){
				if(data.BorderWidth != ''){
					$el.removeClass('stiqr-rounded');
					$el.addClass('stiqr-rounded-border');
				}
			}
			
			if(data.AppendTo){
			/*
				$el.removeClass('stiqr-draggable-contain-to-parent');
				if(data.AppendTo != 'body'){
					$el.addClass('stiqr-draggable-contain-to-parent');
				}
				*/
			}
			
			if(data.PlaceBelow){
				$el.addClass('stiqr-place-below');
				$el.data('place-below',data.PlaceBelow);
			}
			
			if(typeof(data.Style)!='undefined'){
				if(data.Style){
					if(data.Style.charAt(0)=="#"){
						$('head').append("<style>" + data.Style + "</style>");	
					}else{
						
						var css = data.Style;
						var xCss = css.split(';');
						$.each(xCss,function(k,v){
							var x = v.split(':');
							var cssName = x[0];
							var cssVal = x[1];
							if(x[2]){
								cssVal = cssVal + x[2];
							}
							$el.css(cssName,cssVal);
						});
					}
				}
			}
			
			if(data.isDynamicHeight == 1){
				$el.css('min-height',data.Height+'px');
				$el.css('height',''); // let min-height do it's magic
			}
			
			if(data.Type == "Apps"){
				if(data.App){
					var app = data.App;
					var settings = data.AppSettings;
					if( typeof(settings) == "string" ){
						settings = JSON.parse(settings);
					}
					settings.elId = elId;
					$LAB
					.script("http://files.stiqr.com/resources/js/jquery/plugins/xLazyLoader/jquery.xLazyLoader.js")
					.wait(function(){
						if(data.isApp){
							data.appObject.onShow(settings);
						}else{
							app.onShow(settings);	
						}
					});
				}
			}
			
			if(data.Js){
				$el.append("<SCRIPT>" + data.Js + "</SCRIPT>");
			}
			
		},
		drawSiteElements: function(){
						$('.stiqr-element').show();
		},
		drawFooter: function(){
	        // draw footer
	        var highest = 0;
	        $('.stiqr-item-container').each(function(){
	            var pos = $(this).position();
	            var height = $(this).height();
	            var highpos = pos.top + height;
	            if($(this).hasClass('stiqr-footer') == false){
	                if(highpos > highest) highest = highpos;
	            }
	        });
	        $('.stiqr-footer').css({top:10+highest+'px',position:'absolute'});
		},
		
		drawServerSite: function(){
			$('.stiqr').each(function(){
				var elId = $(this).attr('id');
				$(this).addClass('stiqr-item-container');
				$(this).addClass('stiqr-resizable');
				stiqr.save({elId:elId,Type:'SiteElement'});
			});
		},
		
		stiqrize: function(elId){
			$('#'+elId).addClass('stiqr').addClass('stiqr-item-container').addClass('stiqr-resizable');
			stiqr.save({elId:elId,Type:'SiteElement'});
		},
		loginPrompt: function(){
			jPromptPass('enter your password: (<a href="javascript:stiqr.forgotPassword();" style="color:blue;text-decoration:none;">forgot?</a>)', '', 'pingram.stiqr.com login', function(pw) {
				stiqr.login(pw);		      		
			});
		},
		login: function(pw){
			if(pw != undefined){
				var authurl = "http://pingram.stiqr.com/admin/site-auth";
		      	stiqr.notify("verifying ...");
		      	$.post(authurl,{SiteID:1654,Password:pw},function(res){
		      		if(res>0){
		      			stiqr.setCred(1654, pw);
		      			stiqr.initAdmin();
		      			$('#stiqr-main').slideDown();
		      		}else{
		      			stiqr.notify("incorrect password");
		      		}
		      	});
		    }
		},
		drawBranding: function(){
			//$("<div class='stiqr-branding' style='width:110px;border:0px solid red;height:26px;text-align:left;color:white;position:fixed;bottom:0;left:0;z-index:99999;'><a href='http://www.stiqr.com' target='_blank'><img src='http://c1292822.cdn.cloudfiles.rackspacecloud.com/marketplace/1012/stickers/1275628341branding.gif' border='0'></a></div>").css({opacity:'0.8',fontSize:'12px',fontFamily:'arial',cursor:'pointer'}).appendTo('body');
			//$("<div class='stiqr-branding' style='width:210px;border:0px solid red;height:100px;border:0; padding:0; margin:0;text-align:left;color:white;position:fixed;bottom:0px;left:20px;z-index:99999;'><a href='http://www.stiqr.com' target='_blank' style='color: black; background-color: #e9e9e9; padding: 20px;border: 0;'>Try Stiqr.com</a></div>").css({opacity:'0.8',fontSize:'12px',fontFamily:'arial',cursor:'pointer'}).appendTo('body');
						
			
			

		},
		drawResize: function(){
			$(window).bind('resize', function () {
				if($(window).width() >= stiqr.siteWidth){
					$.each(stiqr.elements,function(key,element){
						var $el = $('#'+element.elId);
						stiqr.place(element);
						$.each(element,function(k,v){
							switch(k){
								case "Width":
									if(v){
										v = v+""; // convert to string
										if(v.indexOf("px")>0){
											$el.css('width',v);
										}else if(v.indexOf("%")>0){
											if(v == "100%"){
												$el.css({left:0,margin:0});
											}
											$el.css('width',v);
										}else if(v == 'auto'){
		                                	$el.css('width',v);
										}else{
											$el.css('width',v+'px');
										}
									}
								break;
								
								case "Height":
									if(v){
										v = v+""; // convert to string
										if(v.indexOf("px")>0){
											$el.css('height',v);
										}else if(v.indexOf("%")>0){
											if(v == "100%"){
												$el.css({top:0,margin:0,height:$(document).height()});
											}else{
												$el.css('height',v);
											}
										}else{
											$el.css('height',v+'px');
										}
									}
								break;
							}
						});
						if(element.isDynamicHeight == 1){
							$el.css('min-height',element.Height+'px');
							$el.css('height',''); // let min-height do it's magic
						}
					});
					stiqr.drawServerSite();
					stiqr.drawFooter();
				}
			});
		}
		
	}

	// canvas initialize
	$LAB
	.wait()
	.script("http://files.stiqr.com/resources/js/jquery/plugins/xLazyLoader/jquery.xLazyLoader.js")
	.wait(function(){
		stiqr.drawFonts();
		stiqr.drawCanvas();
		stiqr.drawServerSite();
					stiqr.drawSite();
				
		stiqr.drawSiteElements();
		
		// flash of content
		$('body').show();
		stiqr.origWidth = $(window).width();
		stiqr.drawFooter();
		$('.stiqr-text-content').show();
		
				stiqr.drawBranding();
		

			
        		stiqr.drawResize();
		stiqr.drawJs();
	});
	
	//$('body').append("<iframe src='http://www.stiqr.com/analytics' style='display:none;'></iframe>");

	
	
	$LAB
	.script({src:"http://files.stiqr.com/resources/js/newflxhr/flXHR.vbs", type:"text/vbscript"})
	.wait()
        .script("http://files.stiqr.com/resources/js/newflxhr/flensed.js")
	.wait()
	.script("http://files.stiqr.com/resources/js/jquery/plugins.js")
	.wait(function(){

		stiqr.drawSiteScripts();
		
		var xhr = new XMLHttpRequest(); 
		var cors = ("withCredentials" in xhr);
		if(!cors){
			$.flXHRproxy.registerOptions("http://pingram.stiqr.com/",{xmlResponseText:false,loadPolicyURL:"http://pingram.stiqr.com/crossdomain.xml"});
			$.ajaxSetup({transport:'flXHRproxy'});
		}
		
		
				// hot key control panel activate
	 	$(document).bind('keydown', {combi:'shift+f2', disableInInput: true}, function(){
	      	stiqr.loginPrompt();
	    });
				
		$(document).bind('keydown', {combi:'ctrl+shift+s', disableInInput: true}, function(){
			stiqr.saveCanvas();
		});

				
	});
  	
	
	
	
})(sQuery);
if(typeof($)!='function' && typeof(sQuery)!='function'){
   jQuery = sQuery;
   $ = sQuery;
}

