function ExportPDFPageOptimizador(type, url) {
	window.open('PrintContent_' + type/*?url=' + url*/, 'popup', 'width=840, height=' + screen.height + ', menubar=no, scrollbars=yes, toolbar=no, location=no, resizable=no, top=50, left=50');
    return false;
}


function PrintPage(url) {
	//alert(url);
	window.open(url, 'popup', 'width=800, height=600, menubar=no, scrollbars=yes, toolbar=no, location=no, resizable=yes, top=50, left=50');
}

function ExportPDFPage(url, param) {
	var paramAux = escape(param);
	
	window.open(url + '?url=' + paramAux, 'popup', 'width=' + screen.width + ', height=' + screen.height + ', menubar=no, scrollbars=yes, toolbar=no, location=no, resizable=yes, top=50, left=50');
}

function ShowRecoverPass()
{
    //debugger;
    var d = document;
	d.getElementById('divLogin').style.display = 'none';
	d.getElementById('divRecover').style.display = 'block';
	d.getElementById('divTitle').innerHTML = "Recuperar contrase&ntilde;a";
	d.getElementById('ctl00_hdnWindowOpen').value = "P";
}

function showForm(id){
	var d = document;
	d.getElementById('screen').style.display = 'block';
	d.getElementById(id).style.display = 'block';
	
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	var formTop = arrayPageScroll[1] + (arrayPageSize[3] / 10);
	//var formLeft = arrayPageScroll[0];
	
	d.getElementById(id).style.top = formTop+'px';
	
	//d.getElementById('screen'+id).style.height = getyScroll() + 'px';
	d.getElementById('screen').style.height = d.getElementById('main_inside').offsetHeight + 'px';
	d.getElementById('screen').style.top = 0+'px';

	try{
		if(id == "popup_window1"){
			d.getElementById('divLogin').style.display = 'block';
			d.getElementById('divRecover').style.display = 'none';
			d.getElementById('ctl00_hdnWindowOpen').value = "L";
			d.getElementById('divTitle').innerHTML = "Iniciar Sesi&oacute;n";
			
		}
		else
			d.getElementById('ctl00_hdnWindowOpen').value = "R";
	}
	catch(E){}
}
 
function hideForm(){
	var d = document;
	d.getElementById('screen').style.display = 'none';
	if (d.getElementById('popup_window1')) d.getElementById('popup_window1').style.display = 'none';  
	if (d.getElementById('popup_window2')) d.getElementById('popup_window2').style.display = 'none';  
	
	try{
	d.getElementById('ctl00_hdnWindowOpen').value = "";
	}
	catch(E){}
}

function showProduct(id_tab,this_li){
	/* change tab */
	var tabs_lis = document.getElementById("prod_tabs_ul").getElementsByTagName("LI");
	for (var i=0; i<tabs_lis.length; i++) tabs_lis[i].className = '';
	this_li.className = 'cur';
	/* change data list */
	var tabs_lis = document.getElementById("info_tabs_bloks").getElementsByTagName("DIV");
	for (var i=0; i<tabs_lis.length; i++) if (tabs_lis[i].className.indexOf('blogs_box')!=-1) tabs_lis[i].style.display = 'none';
	document.getElementById('info_tabs_blok_'+id_tab).style.display = 'block';
}

function showTab(id_tab,this_li){
	/* change tab */
	var tabs_lis = document.getElementById("ctl00_ContentPlaceHolder1_prod_tabs_ul").getElementsByTagName("LI");
	for (var i=0; i<tabs_lis.length; i++) tabs_lis[i].className = '';
	this_li.className = 'cur';
	/* change data list */
	var tabs_lis = document.getElementById("info_tabs_bloks").getElementsByTagName("DIV");
	for (var i=0; i<tabs_lis.length; i++) if (tabs_lis[i].className.indexOf('blogs_box')!=-1) tabs_lis[i].style.display = 'none';
	document.getElementById('ctl00_ContentPlaceHolder1_info_tabs_blok_'+id_tab).style.display = 'block';
}

function select(divs,lih)
{
	if (divs!=null)
	{
		 document.getElementById('divs_1').style.display='none';
		 document.getElementById(divs).style.display='block';
		 document.getElementById('divs_2').style.display='none';
		 document.getElementById(divs).style.display='block';
	}
	lih.className+=" iehover";
}
function deselect(lih)
{
	document.getElementById('divs_1').style.display='none';
	document.getElementById('divs_2').style.display='none';
	lih.className = lih.className.replace(new RegExp(" iehover\\b"), "");
}	

//from lightbox

function getPageScroll(){

	var xScroll, yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;	
	}

	arrayPageScroll = new Array(xScroll,yScroll) 
	return arrayPageScroll;
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		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;
	
	//	console.log(self.innerWidth);
	//	console.log(document.documentElement.clientWidth);

	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			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;
	}

	//	console.log("xScroll " + xScroll)
	//	console.log("windowWidth " + windowWidth)

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
	//	console.log("pageWidth " + pageWidth)

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

