var actual = null;
var noticias = new Array('principal1','principal2','principal3','principal4');
var imgNews  = new Array('img/07.jpg', 'img/07-2.jpg', 'img/07-3.jpg', 'img/07-4.jpg');
var destinies = new Array('home.html',
			  'planesdepago.html',
			  'informes.html',
			  'recursos.html',
			  'preguntasfrecuentes.html',
			  'quienessomos.html',
			  'http://www.facebook.com/home.php?#/profile.php?id=1522033406&ref=profile',
			  'http://afiliadoswinzingo.blogspot.com/');
var targets = new Array('this',
			  'this',
			  'this',
			  'this',
			  'this',
			  'this',
			  'new',
			  'new');

function getWidth(){
	var pos;
	if (window.innerWidth){
		pos =window.innerWidth;
	}
	else if (document.documentElement && document.documentElement.clientWidth){
		pos= document.documentElement.clientWidth;
	}
	else if (document.body){
		pos= document.body.clientWidth;
	}
	return pos;
}

function oWNZinit(){
	document.getElementById('WNZp').style.left = '' + (getWidth() - 64) + 'px';
	document.getElementById('WNZp').style.width = '' + 64 + 'px';
	document.getElementById('WNZp').style.height = '' + 64 + 'px';
	document.getElementById('WNZc').style.left = '-267px';
}

function oWNZbig(){
	document.getElementById('WNZp').style.left = '' + (getWidth() -331) + 'px';
	document.getElementById('WNZp').style.width = '' + 331 + 'px';
	document.getElementById('WNZp').style.height = '' + 331 + 'px';
	document.getElementById('WNZc').style.left = '' + 0 + 'px';
}

function getLocation() {
  return window.location.toString();
}

function agregar(url, titulo){
	if (document.all){
		window.external.AddFavorite(url,titulo);
		alert('Aņadido a favoritos');
	}
}

function setVisible(id){
	var i=0;
	while (i<noticias.length){
		//alert (noticias[i]);
		if (noticias[i] == id){
			document.all[noticias[i]].className = 'contentNoticiaPrincipal';
			document.all['imgNew'].src = imgNews[i];
		}
		else document.all[noticias[i]].className = 'contentNoticiaPrincipalHidden';
		i++;
	}
	//alert('Vamos a hacer visible' + id);
	//document.all[id].className = 'contentNoticiaPrincipalHidden';
}

function changeURL(num){
	if (num == null) return;
	if (targets[num] == 'this') document.location = destinies[num];
	else window.open(destinies[num]);
	//if (actual == null) document.location = destinies[num];
	//else if (num != actual) document.location = destinies[num];
}

function login(){
	document.location = "";
}

function register(){
	document.location = "";
}


//LOGIN WINDOW
var iframeVisible=0;

// default values (dynamically replaced)
var iwidth=300; 
var iheight=300;
var itop=50;

function resizeIFrame()
{
if (iframeVisible==0) return;
	
var winW = iwidth, winH = iheight;
if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winW = window.innerWidth;
  winH = window.innerHeight;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winW = document.body.offsetWidth;
  winH = document.body.offsetHeight;
 }
}
  
document.getElementById('objectInfoDiv').style.height=iheight;
document.getElementById('objectInfoDiv').style.width=iwidth;
document.getElementById('objectInfo').style.width=iwidth;
document.getElementById('objectInfo').style.height=iheight;

var ileft=(winW-iwidth)/2;
//var itop=(winH-the_height)/2;

document.getElementById('objectInfoDiv').style.top=itop;
document.getElementById('objectInfoDiv').style.left=ileft;
document.getElementById('objectInfo').style.display='block';
}


function hideIFrame() {
	iframeVisible=0;
	document.getElementById('objectInfoDiv').className='invisible_div';
	document.getElementById('objectInfo').style.display='none';
	document.getElementById('objectInfo').src='/affcms/cis/lib/cis/blank.html';
}

function displayIFrame(url,fwidth,fheight,ftop) {
	iframeVisible=1;
	iwidth=fwidth;
	iheight=fheight;
	itop=ftop;
	document.getElementById('objectInfo').contentWindow.document.open();
	document.getElementById('objectInfo').contentWindow.document.write("<html><body><center><span style='font-name: verdana; font-size:11px;font-weight:normal;color:#333333;'>...loading...</span></center></body></html>");
	document.getElementById('objectInfo').contentWindow.document.close();
	resizeIFrame();
	document.getElementById('objectInfoDiv').className='visible_div';
	document.getElementById('objectInfo').src=url;
}

function openMoreInfo() {
	window.open('masinformacion.html','tacwindow','top=150,left=300,width=500,height=400,resizable=no,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no');
}