/*----------------------------------------------------------------------------------------------------------------------------

	SKIN 2 JOIN - Javascript Functions

----------------------------------------------------------------------------------------------------------------------------*/

var lightbox1_width = 500, lightbox1_height= 250;

/*----------------------------------------------------------------------------------------------------------------------------

	showLightbox()

----------------------------------------------------------------------------------------------------------------------------*/

function showLightbox(param){
	document.getElementById('lightbox1').innerHTML = '';
	var arrayPageSize = getPageSize();
	document.getElementById('overlay').style.width = (arrayPageSize[0] + 'px');
	document.getElementById('overlay').style.height = (arrayPageSize[1] + 'px');
	document.getElementById('overlay').style.display = 'block';
	document.getElementById('TB_load1').style.left = ( ( ( arrayPageSize[0] / 2 ) - ( lightbox1_width / 2 ) ) + 'px');
	document.getElementById('TB_load1').style.top = ( ( getPageScroll() + ( 250 ) ) + 'px');
	document.getElementById('TB_load1').style.display = 'block';
	if(func_803 != "")
		LoadURL(param,"showLightbox2(); tiempo_seg=func_803;");
	else
		LoadURL(param,"showLightbox2();");
}

function showLightbox2(){
	var arrayPageSize = getPageSize();
//	var arrayPageSize = getPageSize();
//	document.getElementById('overlay').style.width = (arrayPageSize[0] + 'px');
//	document.getElementById('overlay').style.height = (arrayPageSize[1] + 'px');
//	document.getElementById('overlay').style.display = 'block';
	document.getElementById('lightbox1').style.left = ( ( ( arrayPageSize[0] / 2 ) - ( lightbox1_width / 2 ) ) + 'px');
//	document.getElementById('lightbox1').style.top = ( ( getPageScroll() + ( lightbox1_height / 2 ) ) + 'px');
	document.getElementById('lightbox1').style.top = ( ( getPageScroll() + ( 55 ) ) + 'px');
	document.getElementById('lightbox1').innerHTML = ajax_result;
	document.getElementById('TB_load1').style.display = 'none';
	document.getElementById('lightbox1').style.display = 'block';
	setTimeout('restarseg()',100);
}

function checkLightbox(param, id, img, nc){
	if (func_803 != ''){
		showLightbox(param);
	} else {
		if(sem_popup){
			sem_popup = false;
			visit_ajax = true;
			showLightbox(param);
		}else{
			document.getElementById("overlay").style.display="block";
			var arrayPageSize = getPageSize();
			document.getElementById("lightbox1").style.left = ( ( ( arrayPageSize[0] / 2 ) - ( lightbox1_width / 2 ) ) + "px");
			document.getElementById("lightbox1").style.top = ( ( getPageScroll() + ( 55 ) ) + "px");
			if (nc != ''){
				document.getElementById("thumb_girl").src = document.getElementById("id_"+img).src;
			}
			document.getElementById("lightbox1").style.display="block";
		}
	} 
}

/*----------------------------------------------------------------------------------------------------------------------------

	hideLightbox()

----------------------------------------------------------------------------------------------------------------------------*/

function hideLightbox(){
	document.getElementById('overlay').style.display = 'none'; // hide lightbox and overlay
	document.getElementById('lightbox1').style.display = 'none';
	document.onkeypress = ''; // disable keypress listener
}

/*----------------------------------------------------------------------------------------------------------------------------

	getPageScroll()

		Returns array with y page scroll values.

----------------------------------------------------------------------------------------------------------------------------*/

function getPageScroll(){
	var theTop = 0;
	var old = 0;
	if (window.innerHeight) {
		pos = window.pageYOffset
	} else if (document.documentElement && document.documentElement.scrollTop) {
		pos = document.documentElement.scrollTop
	} else if (document.body) {
		pos = document.body.scrollTop
	}
	return pos;
}

/*----------------------------------------------------------------------------------------------------------------------------

	getPageSize()

		Returns array with page width, height and window width, height

----------------------------------------------------------------------------------------------------------------------------*/

function getPageSize(){
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}

