var Flies = new Object;

function FlyOver(id) {
  for (var i in Flies) {
    FlyKill(i);
    clearTimeout(Flies[i]);
  }
  Flies = new Object;
  var n = ID(id);
  n.style.display = 'block';
  n.style.opacity = 1;
  n.style.filter = "alpha(opacity=100)";
  Flies[id] = true;
}

function FlyOut(id) {
  var n = ID(id);
  Flies[id] = setTimeout("FlyFade('"+id+"')", 200);
}

function FlyKill(id) {
  var n = ID(id);
  n.style.display = 'none';
}

function FlyFade(id) {
  var n = ID(id);
  var op = n.style.opacity;
  if (op < 0.1) {
    FlyKill(id);
    return;
  }
  op -= op / 10;
  n.style.filter = "alpha(opacity=" + (op * 100) + ")";
  n.style.opacity = op;
  Flies[id] = setTimeout("FlyFade('"+id+"')", 10);
}

function ID(id) {
  return document.getElementById(id);
}


function Pop(imgTitle,imgSrc) {
	var scr_width = 452;   // Initial size; will be resized
	var scr_height = 410;  // Initial size; will be resized
	var img_dir = "";

	var newWin = null;
	newWin = window.open("","","width=" + scr_width + ",height=" + scr_height + ",scrollbars=no,resizable=yes");
	if (newWin != null) {
		newWin.focus();
		var htmlCode = "	<html>\n";
		htmlCode +=    "	 <head>\n";
		htmlCode +=    "	  <title>" + imgTitle + "</title>\n";
        htmlCode +=    "      <link rel=\"stylesheet\" type=\"text/css\" href=\"../mission-beach.css\">\n";
		htmlCode +=    "     </head>\n";
		
		htmlCode +=    "     <script type=\"text/javascript\" src=\"../scripts/images.js.php?photo="+imgSrc+"&location="+document.location.href+"\"></script>\n";
		
		htmlCode +=    "	 <body id=\"Pop\" onLoad=\"javascript:self.resizeTo(document.getElementById('Photo').width+15,document.getElementById('Photo').height+150);\">\n";
		(document.layers) ? htmlCode += "<layer id=\"Loading\" class=\"Loading\" visibility=\"visible\" z-index=\"1\">\n" :
                            htmlCode += "<div id=\"Loading\" class=\"Loading\" visibility=\"visible\" z-index=\"1\">\n";
		htmlCode +=	   "	    Please wait, loading...\n";
		(document.layers) ? htmlCode += "</layer>\n" :
                            htmlCode += "</div>\n";
		htmlCode +=    "	   <img id=\"Photo\" src=\"" + img_dir + imgSrc + "\" border=\"1\" alt=\"" + imgTitle + "\" onLoad=\"javascript:(document.layers) ? document.layers['Loading'].visibility='hidden' : document.getElementById('Loading').style.visibility='hidden';\">\n";
		htmlCode +=    "	   <div id=\"Caption\">" + imgTitle + "</div>\n";
		htmlCode +=    "	   <div id=\"PrevNext\"></div>\n";
		
    htmlCode +=    "	   <a href=\"javascript:window.close();\">close window</a>\n";
		
		htmlCode +=    "     <script type=\"text/javascript\">draw_buttons(photo_number);</script>";
		htmlCode +=    "	 </body>\n";
		htmlCode +=    "	</html>";
		newWin.document.write(htmlCode);
		newWin.document.close();
	}
}

function cc(price)
{
  var x=window.open("../cc.html?amt="+price,"","width=500,height=270,scrollbars=yes,resizable=yes");
}

function param_parseURL() {
/* Converts the current URL to a parameter string, and returns it. */
	var paramList = self.location.href.substring(self.location.href.indexOf("?", 1) + 1, self.location.href.length);
	var loop = 0;
	var finished = false;
	var tempParamList = "";
	tempParamList = unescape(paramList);
	tempParamList += "&";
	return(tempParamList);
}

function param_getParam(paramList, name) {
/* Returns a single parameter 'name' given a parameter string 'paramList'. */
	var counter = 0;
	var paramName = new Array();
	var paramValue = new Array();
	paramName[counter] = paramList.substring(0, paramList.indexOf("="));
	paramValue[counter] = paramList.substring(paramList.indexOf("=") + 1, paramList.indexOf("&"));
	counter++;
	for (loop = 0; loop < paramList.length - 1; loop++) {
	if (paramList.substring(loop, loop+1) == "&") {
			paramName[counter] = paramList.substring(loop + 1, paramList.indexOf("=", loop));
			paramValue[counter] = paramList.substring(paramList.indexOf("=", loop) + 1, paramList.indexOf("&", loop + 1));
			counter++;
		}
	}
	var valueFound = false;
	for (loop2 = 0; loop2 < counter; loop2++) {
		if (paramName[loop2] == name) {
			return(paramValue[loop2]);
			valueFound = true;
		}
	}
	if (valueFound == false) {
		return("");
	}
}
