var hide  = true;

function showhide(obj){
	var x = new getObj('samplelayer');
	hide = !hide;
	x.style.visibility = (hide) ? 'hidden' : 'visible';
	setLyr(obj,'samplelayer');
	
}
function sOut(){
	document.images["sample1"].src='http://static.smsmovies.net/gfx/spacer.gif';
}

function sIns(picNr){
	pic1=new Image();
	pic1.src='http://static.smsmovies.net/thumbs/'+picNr+'_pre_2.jpg';
	pic1.onload=document.images['sample1'].src=pic1.src;
	
	pic2=new Image();
	pic2.src='http://static.smsmovies.net/thumbs/'+picNr+'_pre_3.jpg';
	pic2.onload=document.images['sample2'].src=pic2.src;
	
	pic3=new Image();
	pic3.src='http://static.smsmovies.net/thumbs/'+picNr+'_pre_4.jpg';
	pic3.onload=document.images['sample3'].src=pic3.src;
}

function setLyr(obj,lyr,picNr){
	var newX = findPosX(obj);
	var newY = findPosY(obj);
	var x = new getObj('samplelayer');
	x.style.top = newY+10 + 'px';
	x.style.left = newX+9 + 'px';
}

function findPosX(obj){
	var curleft = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)	curleft += obj.x;
	return curleft;
}

function findPosY(obj){
	var curtop = -82;
	var printstring = '';
	if (obj.offsetParent){
		while (obj.offsetParent){
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)	curtop += obj.y;
	return curtop;
}


function getObj(name){
	if (document.getElementById){
		this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
	}
	else if (document.all){
		this.obj = document.all[name];
		this.style = document.all[name].style;
	}
	else if (document.layers){
		if (document.layers[name]){
			this.obj = document.layers[name];
			this.style = document.layers[name];
		}
		else{
			this.obj = document.layers.testP.layers[name];
			this.style = document.layers.testP.layers[name];
		}
	}
}
