// This file is loaded BEFORE jquery

//var server = 'http://localhost/sumopix/docs/';
var server = 'http://www.sumopix.com/';

function confirmChoice (question, loc){
	if(confirm(question)){
		window.location = loc;
	}
	return false;
}

var nResizes = 0;
function resizePage() {
	nResizes++;
	if(nResizes < 10){
		var obj = document.getElementById('resizeMe');
		var obj2 = document.getElementById('resizeMe2');
		var c = 1;	
		var tmp = document.getElementById('coords');
		
		if(tmp != null){
			var element,x, y;
			x = 0;
			y = 0;
			if (tmp.offsetParent) {
				x += tmp.offsetLeft;
				y += tmp.offsetTop;
				while (tmp = tmp.offsetParent) {
					c++;
					if(c >= 10) break;
					x += tmp.offsetLeft;
					y += tmp.offsetTop;
				}
			}
			y-=294;
			var y2 = y + 214;
			if(y > 10000){
				resizePage();
			}
			var newHeight = y + "px";
			var newHeight2 = y2 + "px";
			obj.style.height = newHeight;
			obj2.style.height = newHeight;
		}
	}
}

window.onresize = resizePage;
window.onload = resizePage;

function popUpWindow(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=1000,height=500');");
}
	
	
function changeLang(url, params){
	window.location = url + params;
}

function hover(id){
  var obj = document.getElementById(id);
  if(obj.className != 'selected'){
  	obj.className = 'hover';
  }
}

function haway(id){
	var obj = document.getElementById(id);
	obj.className = 'greyed';
}

function toggleExpress(url){
	if(document.getElementById('enable_express').checked){
		var enable = 'true';
	}else {
		var enable = 'false';
	}
	window.location= url + '&enable_express=' + enable;
}

function showURL(image, url) {
	var a = document.getElementById("ancor"+image+"");
	a.setAttribute('href', url);
	myLightbox.start(a);	
}

function OpenLightBox(id) {
	if(enable_lightbox) {
		var a = document.getElementById("ancor_default"+id+"");
		myLightbox.start(a);
	}	
}

function edit(){
	window.location = '?id=99&pageid=2';
}



