
/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
	Written by Bugimus 
	Copyright © 2001-2002 Bugimus, all rights reserved.
	You may use this code for your own *personal* use provided you leave this comment block intact.  
	A link back to Bugimus' page would be much appreciated.  
	http://bugimus.com/

	This script should work for NN4, NN6, IE5+, and OP6
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */

IE5=NN4=NN6=OPA=false
if(navigator.userAgent.toLowerCase().indexOf("opera")+1)OPA=true
else if(document.all)IE5=true
else if(document.layers)NN4=true
else if(document.getElementById)NN6=true



// Opera doesn't have an onresize event so you have to call rePos all the time.
if(OPA) setInterval("rePos()",500)
var logoDiv;
function initialize() {

	if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
		enableAlphaImages();
	}
	if(NN4){ 
		myObj=document.main
		logoDiv=document.logoDiv;
		if(document.bottomDiv){
			bottomDiv=document.bottomDiv;
		}
		//bottom = document.bottom_pattern
		//leftShadow = document.shadow_left
		//rightShadow = document.shadow_right
		//bottomDirtObj = document.bottomdirt
		//bottomObj = document.bottom
	}else{ 
		myObj=document.getElementById("main").style;
		
		logoDiv=document.getElementById("logoDiv").style;
		

		bottomDiv=document.getElementById("bottomDiv");
		
		//bottom=document.getElementById("bottom_pattern").style
		//leftShadow=document.getElementById("shadow_left").style
		//rightShadow=document.getElementById("shadow_right").style
		
	}
	//alert(document.getElementById("logoDiv").style);
	//alert(logoDiv);
	//alert(document.getElementById("main"));
	rePos()
}
function setupBottom(){
	/*alert(getHeight("middlecolumn"));
	if(NN4){ 
		bottomDiv=document.bottomDiv;
		middleDiv=document.middlecolumn;
	}else{ 
		bottomDiv=document.getElementById("bottomDiv").style;
		middleDiv = document.getElementById("middlecolumn").style;
	}
	if(bottomDiv){
		bottomDiv.top = (getHeight("middlecolumn"))+"px";
	}
	*/
	
	
}
w=800   // width of the div

function rePos() {
		//alert("initialize");
	// compute center coordinate
	if(NN4||NN6) {
		xc=Math.round((window.innerWidth/2)-(w/2))
		xh = window.innerHeight;
	} else {
		xc=Math.round((document.body.clientWidth/2)-(w/2))
		xh = document.documentElement.clientHeight;
	}
	
	if(xc<0){
		xc = 0;
	}
	// reposition div
	if(this.NN4) {
		myObj.moveTo(xc,0)
		logoDiv.moveTo((xc+790-200),35);
		//topDirtObj.moveTo(xc-84,0);
		//bottomDirtObj.moveTo(xc+600);
		//bottom.moveTo(574,getHeight("main"))
		//leftShadow.moveTo(xc-97,0)
		//rightShadow.moveTo(xc+770,0)
	} else {
		myObj.left = xc + "px";
		myObj.height = (xh-180)+"px";
		logoDiv.left = (xc+790-200)+"px";
		
		//bottom.left = (xc+574) + "px";
		/*
		var divh = (getHeight("middlecolumn")>getHeight("rightcolumn"))?getHeight("middlecolumn"):getHeight("rightcolumn");
		var bh = getHeight("bottom_pattern");
		var bpos = xh-bh;
		
		if(bpos<divh){
			
			bottom.top = (divh + 106) + "px";
		}else{
			
			bottom.top = bpos +"px";
		}
		*/
		//leftShadow.left = (xc-97) + "px"
		//rightShadow.left = (xc+770) + "px"
		//bottomDirtObj.top = (getHeight("centerDiv")-200) + "px";
		//leftShadow.height = getHeight("centerDiv") + "px"
		//rightShadow.height = getHeight("centerDiv") + "px"
	}
	myObj.visibility = (NN4) ? "show" : "visible";
	logoDiv.visibility = (NN4) ? "show" : "visible";
	///leftShadow.visibility = (NN4) ? "show" : "visible";
	//rightShadow.visibility = (NN4) ? "show" : "visible";
	//topDirtObj.visibility = (NN4) ? "show" : "visible";
	//bottomDirtObj.visibility = (NN4) ? "show" : "visible";

  	//this.element.visibility = (NS4) ? "hide" : "hidden";

	/*myObj.visibility = "visible";
	topDirtObj.visibility = "visible";
	bottomDirtObj.visibility = "visible";*/
	
}
function getHeight(id){
	return document.getElementById(id).offsetHeight;
}
//PNG
function enableAlphaImages(){
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);
	if (itsAllGood) {
		for (var i=0; i<document.all.length; i++){
			var obj = document.all[i];
			var bg = obj.currentStyle.backgroundImage;
			var img = document.images[i];
			if (bg && bg.match(/\.png/i) != null) {
				var img = bg.substring(5,bg.length-2);
				var offset = obj.style["background-position"];
				obj.style.filter =
				"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img+"', sizingMethod='crop')";
				obj.style.backgroundImage = "url('img/px.gif')";
				obj.style["background-position"] = offset; // reapply
			} else if (img && img.src.match(/\.png$/i) != null) {
				var src = img.src;
				img.style.width = img.width + "px";
				img.style.height = img.height + "px";
				img.style.filter =
				"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='crop')"
				img.src = "img/px.gif";
			}

		}
	}
}


//No spam function for email
function NoSpam(n,d){
	this.location.href = "mailto:"+n+"@"+d;	
}

function SetMenuHeight(h){
	//var flashObj = document.getElementById("menu");
	document.getElementById(div).style.height = h+'px';
}
function SetHeadlineSize(h,w,div){
	//alert(div+":"+h);
	//var flashObj = document.getElementById(div);
	document.getElementById(div).style.height = (h)+'px';
	document.getElementById(div).style.width = w+'px';
	//alert(div);
}
function OpenNew(url,type){
	var win = window.open(url,type);
	win.focus();
}
function ReorderListText(obj){
	this.location.href = this.location.href.split("?")[0]+"?sort="+obj;
}
function ReorderList(obj){
	this.location.href = this.location.href.split("?")[0]+"?sort="+obj.value;
}
function Bookmark(name){
	window.external.AddFavorite(this.location.href,"Yourwallpaper - "+name);
}
function SendToFriend(){
	this.location.href = "sendtofriend.php?url="+escape(this.location.href);	
}
function OpenThumb(src,id){
	
	//win.focus();
	//alert(src);
	var win2 = window.open(src,"thumb_"+id,"width=450,height=500,resizable=0");
	win2.focus();
	//alert(url);
}
function OpenCollectionThumb(src,id){
	
	//win.focus();
	//alert(src);
	var win2 = window.open(src,"thumb_"+id,"width=930,height=520,resizable=0");
	win2.focus();
	//alert(url);
}
function SubmitPricequote(){
	document.getElementById("pricequote_form").submit();
	
}