var winAttr=",resizable=no,personalbar=0,scrollbars=no,menubar=no,toolbar=no,directories=no,location=no,status=yes";

function openWin(page,w,h) {
	window.open(page,"opwn","width="+w+",height="+h+winAttr+",scrollbars=yes").focus();
}

var author="";
var footer="";
function verImagen2(imagen, nombre_ventana, pie, dimensiones, ancho, alto, autor) { 
	this.window.name="viajar";

		var ventana=window.open("about:blank",nombre_ventana,dimensiones+winAttr);
		var codHTML='<HTML><HEAD><TITLE>'+pie+'</TITLE><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD><BODY bgcolor=white leftMargin=0 text=black topMargin=0 marginwidth=0 marginheight=0>'
			+'<IMG SRC="'+imagen+'" WIDTH='+ancho+' HEIGHT='+alto+' BORDER=0>'
			+'<BR><table width='+ancho+' border=0 cellspacing=0 cellpadding=5><tr><td><font size=1 color=#333333 face="Verdana, Arial">';
		if (autor!='')
			codHTML += '<font color=#990000>Fotografía:</font> '+autor+'<br>';
		codHTML += '<font color=#990000>Imagen:</font> '+pie+'<br>'
			+'<div align=right><font color=#660000>&reg; 2004 www.bidagin.com</font></div></font></td></tr></table></BODY></HTML>';
		ventana.document.open();
		ventana.document.write(codHTML);
		ventana.document.close();
	
}

var pkName="";
var img;

function viewImage() {
	var rand = ""+Math.random();
	rand=rand.substring(2,rand.length);
	if (img!=null)
		verImagen2(img.src, rand, pkName, "width="+img.width+",height="+(img.height+90), img.width, img.height, "viajar.com");
}

ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
ie5=(ie4 && (navigator.userAgent.indexOf('MSIE 5')>0 || navigator.userAgent.indexOf('MSIE 6')>0));
var x = 0;
var y = 0;
var trk = 0;
var over;
var offsetx=-85;
var offsety=18;
if (ns4 || ie4) {
   if (ns4) over = document.layers['overDiv']
   if (ie4) over = overDiv.style
   document.onmousemove = mouseMove
   if (ns4) document.captureEvents(Event.MOUSEMOVE)
}

function nd() {
	if (ns4 || ie4) {
		trk = 0;
		hideObject(over);
	}
}

function tip(text) {
	if (text.indexOf("<br>")==-1) text="&nbsp;"+text+"&nbsp;";
	layerWrite("<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BGCOLOR=#333366><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=1 CELLSPACING=0><TR><TD nowrap BGCOLOR=#99ccff><FONT face=Verdana COLOR=#333366>"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>");
	disp();
}

function ampliar_t() { tip("ampliar foto"); }

function disp() {
	if (ns4 || ie4) {
		if (ns4) {
			over = document.layers['overDiv'];
			overWidth=over.clip.width
			windowWidth=window.innerWidth;
		}
		if (ie4) {
			over = overDiv.style
			overWidth=(ie5 ? overDiv.offsetWidth : over.pixelWidth)
			windowWidth=(ie5 ? document.body.offsetWidth : document.body.style.pixelWidth)
		}
		if (trk==0) {
			offsety=18;
			offsetx=-overWidth/2
			goTo(over,x,y+offsety);
			showObject(over);
			trk = 1;
		}
	}
}

function mouseMove(e) {
	if (ns4) {x=e.pageX; y=e.pageY;}
	if (ie4) {x=event.x; y=event.y;}
	if (ie5) {x=event.x+document.body.scrollLeft; y=event.y+document.body.scrollTop;}
	if (trk) {
		goTo(over,x,y+offsety);
	}
}

function layerWrite(txt) {
	if (ns4) {
		var lyr = document.layers['overDiv'].document
		lyr.open()
		lyr.writeln("<html><body>"+txt+"</body></html>")
		lyr.close()
	}
	else if (ie4) document.all["overDiv"].innerHTML = txt
}

function showObject(obj) {
	if (ns4) obj.visibility = "show"
	else if (ie4) obj.visibility = "visible"
}

function hideObject(obj) {
	if (ns4) obj.visibility = "hide"
	else if (ie4) obj.visibility = "hidden"
}

function goTo(obj,xL,yL) {
	xL+=offsetx
	if (xL+overWidth>windowWidth-50)
		xL=windowWidth-50-overWidth;
	if (xL<10) xL=10;
	obj.left = xL
	obj.top = yL
}
