var icont=0;
var message="";
var lock=new Boolean(false);
var sele=new Boolean(false);

function disableselect(e){return false}

function reEnable(){return true}

function clickIE(){
	if (document.all){
		(message);
		return false;
	}
}

function clickNS(e) {
	if (document.layers||(document.getElementById&&!document.all)){
		if (e.which==1||e.which==2||e.which==3) {(message);return false;}
	}
}

if (lock==true) {
	if (document.layers)
		{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
	else
		{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

	document.oncontextmenu=new Function("return false")
	
}

if (sele==true) {
	document.onselectstart=new Function ("return false")
	if (window.sidebar){
		document.onmousedown=disableselect
		document.onclick=reEnable
	}
}

function openwin(page, name, width, height){
	var atributos="resizable=1,scrollbars=1,menubar=0,status=0,width=" + width + ",height=" + height + ",left=" + ((screen.width - width) / 2) + ",top=" + ((screen.height - height) / 2);
	var evaluar="win=window.open('" + page + "', '" + name + "', '" + atributos + "');win.focus();";
	
	eval(evaluar);
}

function copyimage(msg)	{
	var oRng=document.body.createControlRange();
	var oObj=document.getElementById("imgFoto");
				
	oRng.addElement(oObj);
	oRng.execCommand("Copy");
				
	alert(msg);
	return false;
}

function opendlg(page, object) { 
	var rtn;
	
	rtn=showModalDialog(page,null,'dialogwidth=600px;dialogheight=400px;status:0;help=0;center=1;');
	
	if (object!=null) {
		if (rtn==undefined){rtn="";}

		object.value=rtn; 
	}
} 

function openmsg(page) { 
	showModalDialog(page,null,'dialogwidth=500px;dialogheight=295px;status:0;help=0;center=1;');
} 

function openmmedia(medio, codigo, agno, mes, ini, ter, nombre, sw){
	var width=640;
	var height=480;
			
	var atributos="resizable=1,scrollbars=0,menubar=0,status=0,width=" + width + ",height=" + height + ",left=" + ((screen.width - width) / 2) + ",top=" + ((screen.height - height) / 2);
	var evaluar="win=window.open('detalle.aspx?md=" + medio + "&av=" + codigo + "&ye=" + agno + "&mo=" + mes + "&di=" + ini + "&dt=" + ter + "&bt=" + sw + "&de=" + nombre + "', '" + codigo + "', '" + atributos + "');win.focus();";
			
	eval(evaluar);
}

function openmediaHxH(SemiUrl,de){
	var width=640;
	var height=480;
			
	var atributos="resizable=1,scrollbars=0,menubar=0,status=0,width=" + width + ",height=" + height + ",left=" + ((screen.width - width) / 2) + ",top=" + ((screen.height - height) / 2);
	var evaluar="win=window.open('hxh.aspx?md=ADS&av=" + SemiUrl + "&de=" + de + "', 'Hoja', '" + atributos + "');win.focus();";
				
	eval(evaluar);
}

function opennews(medio, catd, catc, rubd, rubc, ini, ter){
	var width=660;
	var height=480;
				
	var atributos="resizable=1,scrollbars=1,menubar=0,status=0,width=" + width + ",height=" + height + ",left=" + ((screen.width - width) / 2) + ",top=" + ((screen.height - height) / 2);
	var evaluar="win=window.open('detailnews.aspx?md=" + medio + "&cd=" + catd + "&cc=" + catc + "&rd=" + rubd + "&rc=" + rubc + "&di=" + ini + "&dt=" + ter +  "', 'News', '" + atributos + "');win.focus();";
				
	eval(evaluar);
}

function redir(url) {parent.boddy.location=url;}

function closewithreturn(value)	{
	returnValue=value;
	self.close();
} 

function status(text) {
	self.defaultStatus=text;
	return true;
}

function iniCont(n){icont=n;}

function notChecked(){
	var listCheck;
	
	listCheck=document.getElementsByTagName("input");
	icont=0;
	
	for (var i=0; i<listCheck.length; i++) {
		if (listCheck[i].id.substr(0,4)=="chk_") {
			if (listCheck[i].checked){
				listCheck[i].checked=false;
			}else{
				icont++;
				listCheck[i].checked=true;
			}
		}
	}
	document.getElementById('lblCont').innerHTML=icont;
	return false;
}

function AllChecked(){
	var listCheck;
	
	listCheck=document.getElementsByTagName("input");
	icont=0;
	
	for (var i=0; i<listCheck.length; i++) {
		if (listCheck[i].id.substr(0,4)=="chk_") {
				icont++;
				listCheck[i].checked=true;
		}
	}
	document.getElementById('lblCont').innerHTML=icont;
	return false;
}

function setChecked(){
	document.getElementById('hidSave').value=ob_t2_list_checked();
}

function countStopChecked(e,n,s){
	if (e.checked==true)
		icont++;
	else
		icont--;

	if (icont > n){
		icont--
		alert(s);
		return false;
	}
	
	document.getElementById('lblCont').innerHTML=icont;				
	return true;
}

function countChecked(e){
	if (e.checked==true)
		icont++;
	else
		icont--;

	document.getElementById('lblCont').innerHTML=icont;				
	return true;
}		

function confirmar(msg) {return confirm(msg);}

void function buttonOnOff(button, value) {
	if (typeof(Page_ClientValidate)=='function') { 
		if (Page_ClientValidate()==false) { return false; }
	} 
	this.disabled=value; 
	button.disabled=value;
}