var url = "http://www.todochocolate.com";
var stat = 'Todo Chocolate'

//--wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
// Produced by DoubleYou, Dec 2001
// www.doubleyou.com
// info@doubleyou.com
//wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww-->

// BrowserCheck Object
function BrowserCheck() {
	var b = navigator.appName;
	if (b=="Netscape") this.b = "ns";
	else if (b=="Microsoft Internet Explorer") this.b = "ie";
	else this.b = b;
	this.version = navigator.appVersion;
	this.v = parseInt(this.version);
	this.ns = (this.b=="ns" && this.v>=4);
	this.ns4 = (this.b=="ns" && this.v==4);
	this.ns5 = (this.b=="ns" && this.v==5);
	this.ie = (this.b=="ie" && this.v>=4);
	this.ie4 = (this.version.indexOf('MSIE 4')>0);
	this.ie5 = (this.version.indexOf('MSIE 5')>0);
	this.min = (this.ns||this.ie);
}
is = new BrowserCheck();


function DynLayer(id,nestref,frame) {
	if (!is.ns5 && !DynLayer.set && !frame) DynLayerInit();
	this.frame = frame || self;

		this.elm = this.event = this.frame.document.all[id];
		this.css = this.frame.document.all[id].style;
		this.doc = document;
		this.x = this.elm.offsetLeft;
		this.y = this.elm.offsetTop;
		this.w = (is.ie4)? this.css.pixelWidth : this.elm.offsetWidth;
		this.h = (is.ie4)? this.css.pixelHeight : this.elm.offsetHeight;
	
	
	this.id = id;
	this.nestref = nestref;
	this.obj = id + "DynLayer";
	eval(this.obj + "=this");
}
function DynLayerMoveTo(x,y) {
	if (x!=null) {
		this.x = x;
		this.css.pixelLeft = this.x;
	}
	if (y!=null) {
		this.y = y;
		this.css.pixelTop = this.y;
	}
}
function DynLayerMoveBy(x,y) {
	this.moveTo(this.x+x,this.y+y);
}
function DynLayerShow() {
	this.css.visibility = "visible";
}
function DynLayerHide() {
	this.css.visibility = "hidden";
}
DynLayer.prototype.moveTo = DynLayerMoveTo;
DynLayer.prototype.moveBy = DynLayerMoveBy;
DynLayer.prototype.show = DynLayerShow;
DynLayer.prototype.hide = DynLayerHide;
DynLayerTest = new Function('return true');


function DynLayerInit(nestref) {
	if (!DynLayer.set) DynLayer.set = true;
	if (is.ie) {
		for (var i=0; i<document.all.tags("DIV").length; i++) {
			var divname = document.all.tags("DIV")[i].id;
			var index = divname.indexOf("Div");
			if (index > 0) {
				eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")');
			}
		}
	}
	return true;
}
DynLayer.nestRefArray = new Array();
DynLayer.refArray = new Array();
DynLayer.refArray.i = 0;
DynLayer.set = false;






function createLayer(id,nestref,left,top,width,height,content,bgColor,visibility,zIndex,other) {

		var str = '\n<DIV id='+id+' style="position:absolute; left:'+left+'; top:'+top+'; width:'+width;
		if (height!=null) {
			str += '; height:'+height;
			str += '; clip:rect(0,'+width+','+height+',0)';
		}
		if (bgColor!=null) str += '; background-color:'+bgColor;
		if (zIndex!=null) str += '; z-index:'+zIndex;
		if (visibility) str += '; visibility:'+visibility;
		str += ';">'+((content)?content:'')+'</DIV>';
		if (nestref) {
			index = nestref.lastIndexOf(".");
			var nestlyr = (index != -1)? nestref.substr(index+1) : nestref;
			document.all[nestlyr].insertAdjacentHTML("BeforeEnd",str);
		}
		else {
			document.body.insertAdjacentHTML("BeforeEnd",str);
		}

}
// Clip Methods
function DynLayerClipInit(clipTop,clipRight,clipBottom,clipLeft) {
	if (is.ie) {
		if (arguments.length==4) this.clipTo(clipTop,clipRight,clipBottom,clipLeft);
		else if (is.ie4) this.clipTo(0,this.css.pixelWidth,this.css.pixelHeight,0);
	}
}
function DynLayerClipTo(t,r,b,l) {
	if (t==null) t = this.clipValues('t');
	if (r==null) r = this.clipValues('r');
	if (b==null) b = this.clipValues('b');
	if (l==null) l = this.clipValues('l');
	
	this.css.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)";
}
function DynLayerClipBy(t,r,b,l) {
	this.clipTo(this.clipValues('t')+t,this.clipValues('r')+r,this.clipValues('b')+b,this.clipValues('l')+l);
}
function DynLayerClipValues(which) {
	var clipv = this.css.clip.split("rect(")[1].split(")")[0].split("px");
	if (which=="t") return (is.ns)? this.css.clip.top : Number(clipv[0]);
	if (which=="r") return (is.ns)? this.css.clip.right : Number(clipv[1]);
	if (which=="b") return (is.ns)? this.css.clip.bottom : Number(clipv[2]);
	if (which=="l") return (is.ns)? this.css.clip.left : Number(clipv[3]);
}
DynLayer.prototype.clipInit = DynLayerClipInit;
DynLayer.prototype.clipTo = DynLayerClipTo;
DynLayer.prototype.clipBy = DynLayerClipBy;
DynLayer.prototype.clipValues = DynLayerClipValues;


function DynLayerWipeInit(clipTop,clipRight,clipBottom,clipLeft) {
	if (arguments.length==4) this.clipInit(clipTop,clipRight,clipBottom,clipLeft);
	else this.clipInit();
}
function DynLayerWipeTo(endt,endr,endb,endl,num,speed,fn) {
	var distt = (endt!=null)? endt-this.clipValues('t'):0;
	var distr = (endr!=null)? endr-this.clipValues('r'):0;
	var distb = (endb!=null)? endb-this.clipValues('b'):0;
	var distl = (endl!=null)? endl-this.clipValues('l'):0;
	this.wipeStart(distt,distr,distb,distl,endt,endr,endb,endl,num,speed,fn);
}
function DynLayerWipeBy(distt,distr,distb,distl,num,speed,fn) {
	this.wipeStart(distt,distr,distb,distl,distt+this.clipValues('t'),distr+this.clipValues('r'),distb+this.clipValues('b'),distl+this.clipValues('l'),num,speed,fn);
}
function DynLayerWipeStart(distt,distr,distb,distl,endt,endr,endb,endl,num,speed,fn) {
	if (this.wipeActive) return;
	if (!fn) fn = null;
	this.wipeActive = true;
	this.wipe(distt/num,distr/num,distb/num,distl/num,endt,endr,endb,endl,this.clipValues('t'),this.clipValues('r'),this.clipValues('b'),this.clipValues('l'),num,1,speed,fn);
}
function DynLayerWipe(dt,dr,db,dl,endt,endr,endb,endl,st,sr,sb,sl,num,i,speed,fn) {
	if (!this.wipeActive) return
	if (i++ < num) {
		this.clipTo(st+i*dt,sr+i*dr,sb+i*db,sl+i*dl);
		setTimeout(this.obj+".wipe("+dt+","+dr+","+db+","+dl+","+endt+","+endr+","+endb+","+endl+","+st+","+sr+","+sb+","+sl+","+num+","+i+","+speed+",\""+fn+"\")",speed);
	}
	else {
		this.wipeActive = false;
		this.clipTo(endt,endr,endb,endl);
		eval(fn);
	}
}
DynLayer.prototype.wipeInit = DynLayerWipeInit;
DynLayer.prototype.wipeTo = DynLayerWipeTo;
DynLayer.prototype.wipeBy = DynLayerWipeBy;
DynLayer.prototype.wipeStart = DynLayerWipeStart;
DynLayer.prototype.wipe = DynLayerWipe;


function DynLayerWrite(html) {
		this.event.innerHTML = html;
}
DynLayer.prototype.write = DynLayerWrite;


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var b;//Referencia al banner

var txt = [];//Nodos de texto
var org_str = [];//Valor original de los nodos
var n_str = [];//Nueva cadena de texto para los nodos

var imgs_b = [];//Imágenes a sustituir

var lnks = [];//Links

var input_txt = [];//Inputs de tipo texto
var input_img = [];//Inputs de tipo imagen

var sels = [];//Selects

var txt_fase = 0;

var changed = false;

var allow_loop = false;
var aktivo = false;
var capas = cont = [];
var allow_mouse = false;


//////////////////////////////LOADING//////////////////////////////////////////
// streaming imagenes....
var mascaraX = 0;
var mascaraY = 0;
var mascaraX2 = 0;
var mascaraY2 = 0;

var imgs_to_load = ['empty.gif','final.gif','images.jpg','marco.gif','stop.gif','thats.gif','whats.gif'];
var imgs_loaded = -1;

function init_loading(){
	ww = document.body.offsetWidth;
	wh = document.body.offsetHeight;

	createLayer('mascaraDiv',null,-500,-500,468,60,null,null,null,10000);
	mascara = new DynLayer('mascaraDiv');	
	
	load_imgs();
}

function load_imgs(){
	imgs_loaded++;
	if (imgs_loaded>=imgs_to_load.length) init();
	else mascara.write('<img src="todochocolate_obsession-'+imgs_to_load[imgs_loaded]+'" onLoad="load_imgs()" onError="load_imgs()">');
}


//////////////////////////////////////INICIALIZACIÓN///////////////////////////////

function init(){

	ww = document.body.offsetWidth;
	wh = document.body.offsetHeight;

	///////////////////NODOS DE TEXTO//////////////////

	var t = document.body.all;
	
	var tt = [];

//	for (var i=0;i<t.length;i++){	
	for (var i=t.length;i--;){
		if (get_has_childs(t[i])) tt[tt.length] = t[i];
	}
//	for (var i=0;i<tt.length;i++){	
	for (var i=tt.length;i--;){
		tt[i].ch = get_childs_ref(tt[i]);
//		for (var j=0;j<tt[i].ch.length;j++){
		for (var j=tt[i].ch.length;j--;){
			txt[txt.length] = tt[i].ch[j];//Almacenamos su referencia
			org_str[org_str.length] = get_org_str(tt[i].ch[j]);//Almacenamos su valor original
			n_str[n_str.length] = get_new_str(tt[i].ch[j]);//Generamos un nuevo string de extensión similar al original
		}
	}	
	
	////////////////////IMÁGENES////////////////////
	t = null;
	
	t = document.images;


	//Las discriminamos en función de su tamaño	
//	for (var i=0;i<t.length;i++){
	for (var i=t.length;i--;){
		if (get_has_dimensions(t[i])) imgs_b[imgs_b.length] = t[i];//Almacenamos su referencia
	}

	/////////////////////LINKS///////////////////
	t = null;
	t = document.getElementsByTagName('A');
	
	//Almacenamos los valores originales de los eventos que vamos a modificar.
	//No nos hace falta guardar el valor de href, porque no lo vamos a modificar
//	for (var i=0;i<t.length;i++){	
	for (var i=t.length;i--;){
		lnks[i] = t[i];
		lnks[i].org_onclick = lnks[i].onclick;
		lnks[i].org_onmouseover = lnks[i].onmouseover;
		lnks[i].org_onmouseout = lnks[i].onmouseout;
	}		
	
	/////////////////////SELECTS///////////////////
	t = null;
	t = document.getElementsByTagName('SELECT');
	//Almacenamos el valor original del evento que vamos a modificar
//	for (var i=0;i<t.length;i++){
	for (var i=t.length;i--;){
		sels[i] = t[i];
		sels[i].org_onchange = sels[i].onchange;
	}		
	
	////////////////////INPUTS////////////////////
	t = null;
	t = document.getElementsByTagName('INPUT');
//	for (var i=0;i<t.length;i++){
	for (var i=t.length;i--;){
		if (t[i].type=='text') input_txt[input_txt.length] = t[i];
		if (t[i].type=='image') input_img[input_img.length] = t[i];
	}		
	//Almacenamos el valor original del evento que vamos a modificar
//	for (var i=0;i<input_txt.length;i++){
	for (var i=input_txt.length;i--;){
		input_txt[i].org_onkeypress = input_txt[i].onkeypress;

	}
	
//	for (var i=0;i<input_img.length;i++){
	for (var i=input_img.length;i--;){
		input_img[i].org_onclick = input_img[i].onclick;
		input_img[i].org_onmouseover = input_img[i].onmouseover;
		input_img[i].org_onmouseout = input_img[i].onmouseout;
	}


	//////////////////CREACIÓN DEL BANNER//////////////////
	b = document.getElementById('jab');
	b.style.position = "relative";
	
	mascara.write('');

	createLayer('dybannerDiv','mascaraDiv',0,0,ww,wh,null,null,null,10);
	dybanner = new DynLayer('dybannerDiv','mascaraDiv');
	dybanner.css.backgroundImage = 'url(todochocolate_obsession_fondo.jpg)';
	
	mascaraX = b.offsetLeft;
	mascaraY = b.offsetTop;

	var q = document.getElementById('mascaraDiv');

	q.style.cursor = 'hand';
	q.onclick = send_to_web;
	q.onmouseover = init_change;


	var mensaje_data = [null,['whats',0],['thats',468],['final',468]];
	mensaje = [];
	for (var i=1;i<mensaje_data.length;i++){
		createLayer('mensaje'+i+'Div','mascaraDiv',0,0,468,60,'<img src="todochocolate_obsession_'+mensaje_data[i][0]+'.gif" alt=""  width="468" height="60" border="0" isBan="true">',null,null,100);
		mensaje[i] = new DynLayer('mensaje'+i+'Div','mascaraDiv');
		mensaje[i].clipTo(0,468,60,mensaje_data[i][1]);
	}
	
	createLayer('mensajeFondoDiv','mascaraDiv',0,0,468,60,'<img src="todochocolate_obsession_marco.gif" alt=""  width="468" height="60" border="0" isBan="true">',null,null,30);
	mensajeFondo = new DynLayer('mensajeFondoDiv','mascaraDiv');

	createLayer('stop1Div','mascaraDiv',420,40,37,11,'<img src="todochocolate_obsession_stop.gif" alt="" width="37" height="11" border="0" isBan="true">',null,'hidden',500);
	stop1 = new DynLayer('stop1Div','mascaraDiv');

	start_banner();
	
}

//////////////////////////////////////////FUNCIONAMIENTO DEL BANNER/////////////////////

function start_banner() {
	mascara.moveTo(mascaraX, mascaraY);
	change_copy(1);
	set_loop();
	document.onmousemove = mouseMove;
	allow_mouse = true;
//	setTimeout('loopa()',150);
}

function set_loop(){
	allow_loop = !allow_loop;
}

function change_copy(fase){

	switch(fase){
		case 1:
			mensaje[1].wipeTo(0,468,60,0,50,10)
			break;
		case 2:
			mensaje[2].clipTo(0,0,60,0);
			mensaje[1].wipeTo(0,0,60,0,50,10,'change_copy(3)');
			break;
		case 3:
			mensaje[2].wipeTo(0,468,60,0,50,10,'stop1.show();');
			set_loop();
			aktivo = true;
			allow_mouse = true;
//			document.onmousemove = mouseMove;
			loopa();
			var q = document.getElementById('mascaraDiv');
			q.onmouseover = change;
			break;
		case 4:
			stop1.hide();
			mensaje[3].clipTo(0,0,60,0);
			mensaje[2].wipeTo(0,0,60,0,50,10,'change_copy(5)');
			var q = document.getElementById('mascaraDiv');
			q.onmouseover = null;			
			break;
		case 5:
			mensaje[3].wipeTo(0,468,60,0,50,10,'aktivo=false');
			setTimeout('re_start()',10000);
			break;
		case 6:
			mensaje[1].clipTo(0,0,60,0);
			mensaje[3].wipeTo(0,0,60,0,50,10,'start_banner()');
			break;
	}

}

function init_change(){
	var q = document.getElementById('mascaraDiv');
	q.onmouseover = null;

	allow_mouse = false;
//	document.onmousemove = null;
	set_loop();
	change();
}


function re_start(){
	changed = false;
	change_copy(6);
	var q = document.getElementById('mascaraDiv');
	q.onmouseover = init_change;	
}

var posX=0;
var posY=0;
var oldX=0;
var oldY=0;
/*
function DynMouseMove(x,y) {

	if (!allow_mouse) return;

	if (!start_set) {
		oldX=x;
		oldY=y;
		start_set=true;
		return;
	}
	
	for (var i=0; i<capas.length; i++) capas[i].moveBy((oldX-x)*0.2,(oldY-y)*0.2);
	//for (var i in capas) setTimeout("capas["+i+"].moveBy("+(oldX-x)*0.2+","+(oldY-y)*0.2+")",10);
	oldX=x;
	oldY=y;
}
*/
function mouseMove(e) {
	if (!allow_mouse) return;
	var x = event.x+document.body.scrollLeft;
	var y = event.y+document.body.scrollTop;



//	var vx = Math.round((posX*100)/ww);
//	var vy = Math.round((posY*190)/wh);	
	
//	for (var i=0; i<capas.length; i++) capas[i].moveBy((oldX-x)*0.2,(oldY-y)*0.2);

//	dybanner.moveBy((oldX-x)*0.2,(oldY-y)*0.2);
//	for (var i in capas) setTimeout("capas["+i+"].moveBy("+(oldX-x)*0.2+","+(oldY-y)*0.2+")",10);
	
	var vx = Math.round(dybanner.x+(posX-x)*0.2);
	var vy = Math.round(dybanner.y+(posY-y)*0.2);

	setTimeout("dybanner.moveTo("+vx+","+vy+");",0);				

	posX=x;
	posY=y;


	
	if (!aktivo){
		oldX=posX;
		oldY=posY;
	}

		


	
	return true;
}

function loopa(){
//return;
	if (!aktivo) return;
/*
//	for (var i=0;i<capas.length;i++){
	for (var i=capas.length;i--;){
//		var dx = Math.round((posX*capas[i].mx)/ww);
//		var dy = Math.round((posY*capas[i].my)/wh);
		var dx = Math.round((posX*100)/ww);
		var dy = Math.round((posY*190)/wh);

		//capas[i].moveTo(-dx,-dy);
		setTimeout('capas['+i+'].moveTo('+-dx+','+-dy+')',10*i);
	}
*/
	for (var i=0; i<capas.length; i++) capas[i].moveBy((oldX-posX)*0.2,(oldY-posY)*0.2);

	oldX = posX;
	oldY = posY;	
	
	setTimeout('loopa()',15);
}

function send_to_web(){
	location.href="http://www.todochocolate.com";
}

function change(){


	if (changed) {revert();return;}

	////////////LINKS////////////////	
//	for (var i=0;i<lnks.length;i++){	
	for (var i=lnks.length;i--;){
		lnks[i].onclick = function(){
			location.href = url;
			return false;
		}
		lnks[i].onmouseover = function(){
			status = stat;
			return true;
		}
		lnks[i].onmouseout = function(){
			status = '';
			return true;
		}
	}	

	/////////////SELECTS//////////////////
//	for (var i=0;i<sels.length;i++){
	for (var i=sels.length;i--;){
		sels[i].onchange = function(){
			location.href = url;
		}
	}		

	////////////INPUTS///////////////////
//	for (var i=0;i<input_txt.length;i++){
	for (var i=input_txt.length;i--;){
		input_txt[i].lets = ['C','h','o','c','o','l','a','t','e','.',' '];
		input_txt[i].str = '';
		input_txt[i].fase = 0;
		input_txt[i].onkeypress = function(){
			this.value = '';
			if (this.fase>=this.lets.length) this.fase = 0;
			this.str+=this.lets[this.fase];
			this.value = this.str;
			this.fase++;
			return false;
		}
	}
	
//	for (var i=0;i<input_img.length;i++){
	for (var i=input_img.length;i--;){
		input_img[i].onclick = function(){
			location.href = url;
			return false;
		}
		input_img[i].onmouseover = function(){
			status = stat;
			return true;
		}
		input_img[i].onmouseout = function(){
			status = '';
			return true;
		}		
	}

	changed = true;

	////////////CAMBIO DE TEXTOS/////////////

	txt_fase = 0;
	txt_loop();
}

function txt_loop(){
	if (!changed) return;

	if (txt_fase>=txt.length) {create_img_capas();return;}
	if (txt[txt_fase]!=null) txt[txt_fase].nodeValue = n_str[txt_fase];
	if (txt[txt_fase+1]!=null) txt[txt_fase+1].nodeValue = n_str[txt_fase+1];
	txt_fase+=2;
		setTimeout('txt_loop()',10);	
}

function create_img_capas(){

	if (cont.length<1){
		for (var i=0;i<imgs_b.length;i++){
			imgs_b[i].style.position = "relative";
			createLayer('cont'+i+'Div',null,imgs_b[i].offsetLeft,imgs_b[i].offsetTop,imgs_b[i].width,imgs_b[i].height,null,null,'hidden',10);
			cont[i] = new DynLayer('cont'+i+'Div');
			createLayer('capa'+i+'Div','cont'+i+'Div',-imgs_b[i].offsetLeft,-imgs_b[i].offsetTop,ww,wh+500,null,null,null,10);
			capas[i] = new DynLayer('capa'+i+'Div','cont'+i+'Div');
			capas[i].css.backgroundImage = 'url(todochocolate_obsession_fondo.jpg)';

		}
	}		
	
	dybanner.moveTo(-b.offsetLeft,-b.offsetTop);
	for (var i=cont.length;i--;) setTimeout('cont['+i+'].show();',150*i);
	
	setTimeout('change_copy(2)',cont.length*150);
}


/////////////////////VUELTA AL ESTADO ORIGINAL/////////////////
function revert(){

	///IMÁGENES
//	for (var i=0;i<cont.length;i++) cont[i].hide();
	for (var i=cont.length;i--;) cont[i].hide();

	/////////////TEXTOS///////////////
//	for (var i=0;i<txt.length;i++){
	for (var i=txt.length;i--;){
		if (txt[i]!=null) txt[i].nodeValue = org_str[i];
	}

	////////////LINKS////////////////	
//	for (var i=0;i<lnks.length;i++){
	for (var i=lnks.length;i--;){
		lnks[i].onclick = lnks[i].org_onclick;
		lnks[i].onmouseover = lnks[i].org_onmouseover;
		lnks[i].onmouseout = lnks[i].org_onmouseout;
	}
	
	/////////////SELECTS//////////////////
//	for (var i=0;i<sels.length;i++){
	for (var i=sels.length;i--;){
		sels[i].onchange = sels[i].org_onchange;
	}		

	////////////INPUTS///////////////////
//	for (var i=0;i<input_txt.length;i++){
	for (var i=input_txt.length;i--;){
		input_txt[i].onkeypress = input_txt[i].org_onkeypress;
	}
	
//	for (var i=0;i<input_img.length;i++){
	for (var i=input_img.length;i--;){
		input_img[i].onclick = input_img[i].org_onclick;
		input_img[i].onmouseover = input_img[i].org_onmouseover;
		input_img[i].onmouseout = input_img[i].org_onmouseout;
	}
	
	change_copy(4);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////FUNCIONES AUXILIARES///////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////

function get_has_childs(ref){

	if (!ref.childNodes) return false;

	var tmp = false;
	var c = ref.childNodes;
	
//	for (var i=0;i<c.length;i++){
	for (var i=c.length;i--;){
		if(ref.childNodes.item(i).nodeValue!=null && ref.childNodes.item(i).nodeValue.length>3) tmp = true;
	}
	
	return tmp;
}

function get_childs_ref(ref){

	var c = ref.childNodes;
	var tmp = [];
	
//	for (var i=0;i<c.length;i++){
	for (var i=c.length;i--;){
		if(ref.childNodes.item(i).nodeValue!=null && (ref.childNodes.item(i).nodeValue.length>3 || ref.childNodes.item(i).nodeValue=='&#8364;')) tmp[tmp.length] = ref.childNodes.item(i);
	}

	return tmp;	

}

function get_org_str(ref){
	if (typeof ref !='object') return null;
	return ref.nodeValue;
}

function get_new_str(ref){
	if (typeof ref !='object') return null;
	
	var t_str = 'Chocolate ';
	
	if (ref.nodeValue.length>20) {
		var n = 9;
		do{
			t_str+=', chocolate';
			n+=11;
		}
		while(n<ref.nodeValue.length)
		t_str+=' ';
	}
	
	return t_str;

}


function get_has_dimensions(ref){

	if (ref.isBan || ref.src.lastIndexOf('lm.gif')>-1) return false;

	return (ref.width && ref.width>=20 && ref.height && ref.height>=20) ? true : false;

}

function get_dimensions(){
	ww = document.body.offsetWidth;
	wh = document.body.offsetHeight;
}

window.onresize = get_dimensions;
window.onload = init_loading;	

