// JavaScript Document
var jsloader = function () {
	var f=[],s=[]; //,vw=0,vh=0,ww=0,wh=0,i=0,ii=document.images.length,imgs=[],p;
	
	if(window.addEventListener){
		window.addEventListener("load",run,false);
		//window.addEventListener("scroll",loadImgs,false);
	}else if(window.attachEvent){
		window.attachEvent("onload",run);
		//window.attachEvent("scroll",loadImgs);
	}else{
		window.onload=run;
		//window.onscroll=loadImgs;
	}
	/*
	wh = Math.max(
        Math.max(document.body.scrollHeight, document.documentElement.scrollHeight),
        Math.max(document.body.offsetHeight, document.documentElement.offsetHeight),
        Math.max(document.body.clientHeight, document.documentElement.clientHeight)
			 );
	
	ww = Math.max(
        Math.max(document.body.scrollWidth, document.documentElement.scrollWidth),
        Math.max(document.body.offsetWidth, document.documentElement.offsetWidth),
        Math.max(document.body.clientWidth, document.documentElement.clientWidth)
			 );
	
	if (typeof window.innerWidth != 'undefined') {
		vw = window.innerWidth;
		vh = window.innerHeight;
		
	} else if ( typeof document.documentElement != 'undefined'
			 && typeof document.documentElement.clientWidth != 'undefined'
			 && document.documentElement.clientWidth != 0 )
	{
		vw = document.documentElement.clientWidth;
		vh = document.documentElement.clientHeight;
	} else {
		vw = document.getElementsByTagName('body')[0].clientWidth;
		vh = document.getElementsByTagName('body')[0].clientHeight;
	}
	
	var remove=[], keep=[];
	for( ; i<ii; i++ ) {
		p=findPos(document.images[i]);
		if ( (p[0]>vw || p[1]>vh) && !document.images[i].complete) {
			imgs.push({"src":document.images[i].src,"i":i});
			remove.push(document.images[i].src+' : '+(document.images[i].complete));
			document.images[i].src = '';
		} else {
			keep.push(document.images[i].src);
		}
	}
	
	alert( 'KEEP\n-----------\n'+keep.join('\n')+'\n\nREMOVE\n-------------\n'+remove.join('\n') );
	
	
	function findPos( e ) {
		var l = t = 0;
		if (e.offsetParent) {
			do {
				l += e.offsetLeft;
				t += e.offsetTop;
			} while (e = e.offsetParent);
		}
		return [l,t];
	}
	
	
	function loadImgs() {
		var i=0,ii=0;
		if ( !imgs || !(ii=imgs.length) ) return;
		var r=[],p,load=[]
			 ,sl=document.body.scrollLeft||window.pageXOffset||
			 		(document.body.parentElement?document.body.parentElement.scrollLeft:0)
			 ,st=document.body.scrollTop||window.pageYOffset||
			 		(document.body.parentElement?document.body.parentElement.scrollTop:0);
		
		for( ; i<ii; i++ ) {
			p=findPos(imgs[i]);
			if ( p[0]-sl<=0 || p[1]-st<=1 ) {
				document.images[imgs[i]['i']].src = imgs[i].src;
				r.push(i);
			}
		}
		i=r.length;
		while( i-- ) imgs.splice(i,1);
		
	}
	*/
	
	function run(){if(s.length){load();}else{call();}}
	
	function load(){
		if(!s.length)return;
		if(!document.body){ setTimeout('run()',100); return; }
      var e=document.createElement('script');
		e.onreadystatechange=function(){if(e.readyState=='loaded'||e.readyState=='complete')run();};
		e.onload=function(){run();return;};
		e.src=s[s.length-1];
		document.body.appendChild(e);
		s.pop();
	}
	
	function call(){
		for(var i=f.length-1; 0<=i; i-- ) {
			if ( typeof(f[i]['f']) == 'function' ) {
				f[i]['f'].apply(null,f[i]['a'])
				continue;
			}
			if ( typeof(window[f[i]['f']]) != 'function' ) continue;
			window[f[i]['f']].apply(null,f[i]['a']);
		}
		f=[];
		if ( !window.fbAsyncInit ){
			window.fbAsyncInit=function(){FB.init({appId:'120407537995045',status:true,cookie:true,xfbml:true});};
			(function(){var e=document.createElement('script');e.type='text/javascript';e.src=document.location.protocol+'//connect.facebook.net/en_US/all.js';e.async=true;document.getElementById('fb-root').appendChild(e);}());
		}
	}
	
	return {
		load:function(){for(var i=0,ii=arguments.length;i<ii;i++)s.unshift(arguments[i]);},
		call:function(func){
			var a=[],i=0,ii=arguments.length;
			for( ; i<ii; i++ ) { if (i==0)continue; a.push(arguments[i]); }
			f.unshift({'f':func,'a':a});
		}
	}
	
}();

