//original scripts => by coyarzun http://www.error404.cl
//
//
$(document).ready(function(){
	var menuzone = $("ul.MenuBarHorizontal > li:eq(6)");
	var img_link = new Image();
	img_link.src = "http://www.mac.uchile.cl/images/2006/menu/conserv_document.gif";
	var img_hover = new Image();
	img_hover.src = "http://www.mac.uchile.cl/images/2006/menu/conserv_document_blanco.gif";
	//
	menuzone.after('<li class="conserv"><a href="http://www.mac.uchile.cl/conservacion_documentacion"><img border="0" src="' + img_link.src + '" height="15"/></a></li>');
	$('.grismenufondo .anchomenu').css('width','960px');
	//
	$('ul.MenuBarHorizontal li.conserv img').hover(
		function(){
			$(this).attr({'src':img_hover.src, 'height':'15'});
		},
		function(){
			$(this).attr({'src':img_link.src, 'height':'15'});
		}
	);
		
});
//
var popUpCounter= 0;
var oldWindors;
//
function setMe(){
	var mainW = 670;
	var mainH = 610;
	window.parent.resizeTo(mainW,mainH);
	window.parent.moveTo((screen.availWidth-mainW)*.5,(screen.availHeight-mainH)*.5);
}
//
function htmlPopup(dPath,dWidth,dHeight){
	var leftOffset = (screen.availWidth - dWidth - 10)*.5;
	var topOffset = (screen.availHeight - dHeight - 30)*.5;
	var wArgs = "width="+dWidth+",height="+dHeight+",top="+topOffset+",left="+leftOffset+",scrollbars=no,toolbars=no";
	popupItself(dPath,wArgs);
}
//
function imgPopup(dPath,dWidth,dHeight){
	var leftOffset = (screen.availWidth - dWidth - 10)*.5;
	var topOffset = (screen.availHeight - dHeight - 30)*.5;
	var wArgs = "width="+dWidth+",height="+dHeight+",top="+topOffset+",left="+leftOffset+",scrollbars=no";
	dPath= "http://www.error404.cl/imgpop.php?dPath="+dPath+"&dW="+dWidth+"&dH="+dHeight;
	popupItself(dPath,wArgs);
}
//
function swfPopup(swfPath,dWidth,dHeight,dQuality,dBgcolor){
	var leftOffset = (screen.availWidth - dWidth - 10)*.5;
	var topOffset = (screen.availHeight - dHeight - 30)*.5;
	var dPath;
	var wArgs = "width="+dWidth+",height="+dHeight+",top="+topOffset+",left="+leftOffset+",scrollbars=no";
	dBgcolor = dBgcolor.substring(1,dBgcolor.length);
	dPath = "swfPopup.php?swfPath="+swfPath+"&dWidth="+dWidth+"&dHeight="+dHeight+"&dQuality="+dQuality+"&dBgcolor="+dBgcolor;
	popupItself(dPath,wArgs);
}
//
function popupItself(dPath,wArgs){
	//
	if((oldWindors!=null) && (!oldWindors.closed)){
		oldWindors.close();
		//alert(oldWindors.closed)
	};
	//
	oldWindors = "popUp_"+(popUpCounter++);
	//alert(oldWindors);
	//
	var windors =window.open(dPath,oldWindors,wArgs);
	oldWindors=windors;
	windors.focus();
}
