function xDocSize()
{
	var b=document.body, e=document.documentElement;
	var esw=0, eow=0, bsw=0, bow=0, esh=0, eoh=0, bsh=0, boh=0;
	if (e) {
		esw = e.scrollWidth;
		eow = e.offsetWidth;
		esh = e.scrollHeight;
		eoh = e.offsetHeight;
	}
	if (b) {
		bsw = b.scrollWidth;
		bow = b.offsetWidth;
		bsh = b.scrollHeight;
		boh = b.offsetHeight;
	}
	//  alert('compatMode: ' + document.compatMode + '\n\ndocumentElement.scrollHeight: ' + esh + '\ndocumentElement.offsetHeight: ' + eoh + '\nbody.scrollHeight: ' + bsh + '\nbody.offsetHeight: ' + boh + '\n\ndocumentElement.scrollWidth: ' + esw + '\ndocumentElement.offsetWidth: ' + eow + '\nbody.scrollWidth: ' + bsw + '\nbody.offsetWidth: ' + bow);

	var Coors = new Array();
	Coors[0]= Math.max(esw,eow,bsw,bow);
	Coors[1] = Math.max(esh,eoh,bsh,boh);

	return Coors;
	//return {pageW:Math.max(esw,eow,bsw,bow),pageH:Math.max(esh,eoh,bsh,boh)};
}


function page_grey(w,h)
{
	var docObj = document.getElementById("main_body");

	var browser = findBrowser();

	if(w == 0 && h == 0)
	{

		if(browser == "FF" || browser == "SAF" || browser == "OP" )
		{
			var winY = window.innerHeight+window.pageYOffset;
			//var winX = window.innerWidth-18;
			var winX = docObj.clientWidth;
		}
		else if(browser == "IE")
		{
			var scrollTop = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
			var winX = document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth;
			var winY = document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
			winY = winY+scrollTop;
		}

		var grey_div = document.createElement('div');
		grey_div.setAttribute("style","");
		grey_div.setAttribute("id","grey_div");
		if(document.getElementById('grey_mouse_over') != undefined)
		{
			grey_div.setAttribute("onmouseover","destroyWindowsOut()");
		}
		grey_div.style.position = "absolute";
		grey_div.style.top = "0px";
		grey_div.style.left = "0px";
		grey_div.style.width = winX+"px";
		grey_div.style.height = winY+"px";
		grey_div.style.zIndex = "10000";
		grey_div.style.backgroundColor = "#000000";

		if(browser == "IE")
		{
			grey_div.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=60)";
		}
		else if(browser == "FF" || browser == "OP" || browser == "SAF" )
		{
			grey_div.style.opacity = "0.6";
		}

		grey_div.style.visibility = "visible";
		docObj.appendChild(grey_div);
	}
	else
	{
		winX = w;
		winY = h;

		document.getElementById("grey_div").style.width = winX+"px";
		document.getElementById("grey_div").style.height = winY+"px";
	}
}

function refresh_grey_overlay()
{
	if(document.getElementById("grey_div") != null)
	{
		var greyOverlay = document.getElementById("grey_div").style;
	}
	var browser = findBrowser();

	if(greyOverlay)
	{
		if(greyOverlay.visibility == "visible")
		{
			if(browser == "FF" || browser == "SAF" || browser == "OP")
			{
				var winY = window.innerHeight+window.pageYOffset+150;
				var winX = (window.innerWidth)+window.pageXOffset;

				var maxSize = xDocSize();

				if(winX >= maxSize[0])
				{
					winX = maxSize[0];
				}

				if(winY >= maxSize[1])
				{
					winY = maxSize[1];
				}

				page_grey(winX,winY);
			}
			else if(browser == "IE")
			{
				var scrollTop = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
				var scrollLeft = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft;



				if(document.documentElement.clientHeight == "" || document.documentElement.clientHeight == "undefined")
				{
					//fix for IE 5.0
					var winY  = document.body.clientHeight+scrollTop+150;
					var winX = document.body.clientWidth+scrollLeft;
				}
				else
				{
					// IE 6.0,7.0
					var winY = document.documentElement.clientHeight+scrollTop+150;
					var winX = document.documentElement.clientWidth+scrollLeft;
				}


				/************************************/
				/** this is a special fix
				** so the browser scrollbars
				** dont fall into an infinite loop
				** and have a neverending scrolls on the page
				**/
				/**************************************/

				var maxSize = xDocSize();

				if(winX >= maxSize[0])
				{
					winX = maxSize[0];
				}

				if(winY >= maxSize[1])
				{
					winY = maxSize[1];
				}

				page_grey(winX,winY);
			}
		}
	}
	refresh_topDiv();
}


function preloader(imgObj,content,caption,credit,divHeight,id)
{
	var creditToShow = '';
	var browser = findBrowser();
	/*************************************/
	/** grabs the created container
	** and replaces its content
	**/
	var divObj = document.getElementById("overlay_div");

	var maxSize = xDocSize();

	if(browser == "FF" || browser == "SAF" || browser == "OP" )
	{
		var topOffset = window.pageYOffset;
	}
	else if(browser == "IE")
	{
		var topOffset = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
	}

	/*To check whether golfing or non golfing page: 21-11-2008*/
	var str = window.location.href;
	var reg = new RegExp("/golfing/");
	if (reg.test(str))
	{
		var image = "/images/shell/golfing/golf_photopop_close_btn.gif";
		var repeatedline = "/images/shell/greyline_repeat.gif";
		var closetext = "";
	}
	else
	{
		var image = "/images/shell/photopop_close_btn.gif";
		var repeatedline = "/images/shell/blueline_repeat.gif";
		var closetext = "<span class='closePop'>Close</span>&nbsp;";
	}

	if(credit != "")
	{
	 var creditToShow = credit;
	}

	if(imgObj.complete)
	{
		var maxSize = xDocSize();
		boxY = Math.round((maxSize[0]/2) - (imgObj.width/2));

		var tableWidth = imgObj.width+"px";

		/**
		** the +100 in height adds the space for the caption
		**/

		divObj.style.width = imgObj.width+"px";
 	    //divObj.style.height= imgObj.height+100+"px";
		divObj.style.top = topOffset+30+"px";
		divObj.style.left = (boxY-20)+"px";

		/**
		** this is the output for the popup
		** if its already preloaded
		**/

		/*var sHTML = "<table border='0' width='"+tableWidth+"' cellpadding='0' cellspacing='0' valign='top'>";
		sHTML += "<tr><td align='right'>";
		sHTML += "<table border='0' cellpadding='0' cellspacing='0'><tr><td align='right' class='closePop'>Close</td>"
		sHTML += "<td align='right'><a href='javascript:void(0);' onClick='destroyWindows();'><img src=\"/images/shell/photopop_close_btn.gif\" border=\"0\" /></a></td></tr>"
		sHTML += "</table></td></tr><tr><td height='10'></td></tr>";
		sHTML += "<tr><td align='center'><img src='http://cdn.visitflorida.com/images/photos/"+content+"' style='border: 1px #7fa6e4 solid;'></td></tr>";
		sHTML += "<tr><td height='7'></td></tr><tr><td align='left' valign='top'>";
		sHTML += "<tr><td align='left' class='popCaption'>"+caption+"</td></tr>"+creditToShow+"<tr><td height='7'></td></tr>";
		sHTML += "<tr><td style='background-image: url(/images/shell/blueline_repeat.gif); background-repeat: repeat-x;height: 1px;'></td></tr>";
		sHTML += "<tr><td height='10'></td></tr><tr><td align='left' class='popLinks'>See: <a href='/"+cTagGroup+"/photos/id."+id+"' class='popLinks'>comments</a>, <a href='/"+cTagGroup+"/photos/id."+id+"' class='popLinks'>tags</a> and <a href='/"+cTagGroup+"/photos/id."+id+"' class='popLinks'>more</a></td></tr><tr><td height='10'></td></tr></table>";*/


		var sHTML = "<table border=\"0\" cellpadding=\"0\" width='"+tableWidth+"' cellspacing=\"0\">";
        sHTML += "<tr>";
        sHTML += "<td align=\"right\">";
        sHTML += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
        sHTML += "<tr>";
        sHTML += "<td align=\"right\">"+closetext+"</td>";
        sHTML += "<td align=\"right\"><a href=\"javascript:void(0);\" onClick=\"destroyWindows();\"><img src='"+image+"' border=\"0\" /></a></td>";
        sHTML += "</tr>";
        sHTML += "</table>";
        sHTML += "</td>";
        sHTML += "</tr>";
        sHTML += "<tr>";
        sHTML += "<td height=\"10\"></td>";
        sHTML += "</tr>";
        sHTML += "<tr>";
        sHTML += "<td align=\"center\"><img src=\"http://cdn.visitflorida.com/images/photos/"+content+"\" style=\"border: 1px #7fa6e4 solid;\"></td>";
        sHTML += "</tr>";
        sHTML += "<tr>";
        sHTML += "<td height=\"7\"></td>";
        sHTML += "</tr>";
        sHTML += "<tr>";
        sHTML += "<td align=\"left\" valign=\"top\">";
        sHTML += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
        sHTML += "<tr>";
        sHTML += "<td align=\"left\" valign=\"top\" width=\"70%\">";
        sHTML += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
        sHTML += "<tr>";
        sHTML += "<td align=\"left\" valign=\"top\" class='popCaption'>"+caption+"</td>";
        sHTML += "</tr>";
        sHTML += "<tr>";
        if(creditToShow != "")
        {
         sHTML += "<td align='left' class='popCredit'>Photo By: "+credit+"</td>";
        }
        else
        {
         sHTML += "<td height=\"5\"></td>";
        }

        sHTML += "</tr>";
        sHTML += "<tr><td height='10'></td></tr>";
        sHTML += "<tr>";
        sHTML += "<td style='background-image: url("+repeatedline+"); background-repeat: repeat-x;height: 1px;'></td>";
        sHTML += "</tr>";
        sHTML += "<tr><td height='10'></td></tr>";
        sHTML += "<tr>";
        if(cTagGroup != "")
        {
        sHTML += "<td align=\"left\" class=\"popLinks\">See: <a href=\"/"+cTagGroup+"/photos/id."+id+"\" class=\"popLinks\">comments</a>, <a href='/"+cTagGroup+"/photos/id."+id+"' class='popLinks'>tags</a> and <a href='/"+cTagGroup+"/photos/id."+id+"' class='popLinks'>more</a></td>";
        }
        else
        {
          sHTML += "<td align=\"left\" class=\"popLinks\">See: <a href=\"/photos/id."+id+"\" class=\"popLinks\">comments</a>, <a href='/photos/id."+id+"' class='popLinks'>tags</a> and <a href='/photos/id."+id+"' class='popLinks'>more</a></td>";
        }

        sHTML += "</tr>";
        sHTML += "</table>";
        sHTML += "</td>";
        sHTML += "<td align=\"right\" width=\"30%\" style=\"padding-top: 5px;\">";
        sHTML += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\">";
        sHTML += "<tr>";
        sHTML += "<td align=\"right\" style=\"font-family: 'Trebuchet MS', Tahoma, Arial, Verdana,sans-serif;font-size: 18px;color: #4e8dd1;\">See More Photos</td>";
        if(cTagGroup != "")
        {
        sHTML += "<td align=\"right\" width=\"52\"><a href=\"/"+cTagGroup+"/photos/id."+id+"\"><img src=\"/images/shell/allphotos_pop_btn.gif\" border=\"0\" alt=\"See More Photos\" /></a></td>";
        }
        else
        {
        sHTML += "<td align=\"right\" width=\"52\"><a href=\"/photos/id."+id+"\"><img src=\"/images/shell/allphotos_pop_btn.gif\" border=\"0\" alt=\"See More Photos\" /></a></td>";
        }
        sHTML += "</tr>";
        sHTML += "</table>";
        sHTML += "</td>";
        sHTML += "</tr>";
        sHTML += "</table>";
        sHTML += "</td>";
        sHTML += "</tr>";
        sHTML += "<tr><td height='10'></td></tr>";
        sHTML += "</table>";


		divObj.innerHTML = sHTML;
//		divObj.innerHTML += "<tr><td align='right'><table border='0' cellpadding='0' cellspacing='0'><tr><td align='right'>close</td><td align='right'><a href='javascript:void(0);' onClick='destroyWindows();'><img src=\"/images/shell/photopop_close_btn.gif\" border=\"0\" /></a></td></tr></table></td></tr>";
	//	divObj.innerHTML += "<tr><td height='20'></td></tr>";
	//	divObj.innerHTML += "<tr><td align='center'><img src='http://cdn.visitflorida.com/images/photos/"+content+"' style='border: 1px #7fa6e4 solid;'></td></tr>";
	//	divObj.innerHTML += "<tr><td height='10'></td></tr>";
	//	divObj.innerHTML += "<tr><td style='padding-left: 5px;'>"+caption+"</td></tr></table>";

	}
	else
	{
		imgObj.onload = function()
		{
			var maxSize = xDocSize();
			boxY = Math.round((maxSize[0]/2) - (imgObj.width/2));

			var tableWidth = imgObj.width+"px";

			/**
			** the +100 in height adds the space for the caption
			**/

			divObj.style.width = imgObj.width+"px";
			//divObj.style.height= imgObj.height+100+"px";
			divObj.style.top = topOffset+30+"px";
			divObj.style.left = (boxY-20)+"px";

			/**
			** this is the output for the popup
			** if its loading for the first time
			**/

		/*var sHTML = "<table border='0' width='"+tableWidth+"' cellpadding='0' cellspacing='0' valign='top'>";
		sHTML += "<tr><td align='right'>";
		sHTML += "<table border='0' cellpadding='0' cellspacing='0'><tr><td align='right' class='closePop'>Close</td>"
		sHTML += "<td align='right'><a href='javascript:void(0);' onClick='destroyWindows();'><img src=\"/images/shell/photopop_close_btn.gif\" border=\"0\" /></a></td></tr>"
		sHTML += "</table></td></tr><tr><td height='10'></td></tr>";
		sHTML += "<tr><td align='center'><img src='http://cdn.visitflorida.com/images/photos/"+content+"' style='border: 1px #7fa6e4 solid;'></td></tr>";
		sHTML += "<tr><td height='7'></td></tr><tr><td align='left' valign='top'>";
		sHTML += "<tr><td align='left' class='popCaption'>"+caption+"</td></tr>"+creditToShow+"<tr><td height='7'></td></tr>";
		sHTML += "<tr><td style='background-image: url(/images/shell/blueline_repeat.gif); background-repeat: repeat-x;height: 1px;'></td></tr>";
		sHTML += "<tr><td height='10'></td></tr><tr><td align='left' class='popLinks'>See: <a href='/"+cTagGroup+"/photos/id."+id+"' class='popLinks'>comments</a>, <a href='/"+cTagGroup+"/photos/id."+id+"'' class='popLinks'>tags</a> and <a href='/"+cTagGroup+"/photos/id."+id+"'' class='popLinks'>more</a></td></tr><tr><td height='10'></td></tr></table>";
		*/
		var sHTML = "<table border=\"0\" cellpadding=\"0\" width='"+tableWidth+"' cellspacing=\"0\">";
        sHTML += "<tr>";
        sHTML += "<td align=\"right\">";
        sHTML += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
        sHTML += "<tr>";
        sHTML += "<td align=\"right\">"+closetext+"</td>";
        sHTML += "<td align=\"right\"><a href=\"javascript:void(0);\" onClick=\"destroyWindows();\"><img src='"+image+"' border=\"0\" /></a></td>";
        sHTML += "</tr>";
        sHTML += "</table>";
        sHTML += "</td>";
        sHTML += "</tr>";
        sHTML += "<tr>";
        sHTML += "<td height=\"10\"></td>";
        sHTML += "</tr>";
        sHTML += "<tr>";
        sHTML += "<td align=\"center\"><img src=\"http://cdn.visitflorida.com/images/photos/"+content+"\" style=\"border: 1px #7fa6e4 solid;\"></td>";
        sHTML += "</tr>";
        sHTML += "<tr>";
        sHTML += "<td height=\"7\"></td>";
        sHTML += "</tr>";
        sHTML += "<tr>";
        sHTML += "<td align=\"left\" valign=\"top\">";
        sHTML += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
        sHTML += "<tr>";
        sHTML += "<td align=\"left\" valign=\"top\" width=\"70%\">";
        sHTML += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
        sHTML += "<tr>";
        sHTML += "<td align=\"left\" valign=\"top\" class='popCaption'>"+caption+"</td>";
        sHTML += "</tr>";
        sHTML += "<tr>";
        if(creditToShow != "")
        {
         sHTML += "<td align='left' class='popCredit'>Photo By: "+credit+"</td>";
        }
        else
        {
         sHTML += "<td height=\"5\"></td>";
        }

        sHTML += "</tr>";
        sHTML += "<tr><td height='10'></td></tr>";
        sHTML += "<tr>";
        sHTML += "<td style='background-image: url("+repeatedline+"); background-repeat: repeat-x;height: 1px;'></td>";
        sHTML += "</tr>";
        sHTML += "<tr><td height='10'></td></tr>";
        sHTML += "<tr>";
        if(cTagGroup != "")
        {
        sHTML += "<td align=\"left\" class=\"popLinks\">See: <a href=\"/"+cTagGroup+"/photos/id."+id+"\" class=\"popLinks\">comments</a>, <a href='/"+cTagGroup+"/photos/id."+id+"' class='popLinks'>tags</a> and <a href='/"+cTagGroup+"/photos/id."+id+"' class='popLinks'>more</a></td>";
        }
        else
        {
        sHTML += "<td align=\"left\" class=\"popLinks\">See: <a href=\"/photos/id."+id+"\" class=\"popLinks\">comments</a>, <a href='/photos/id."+id+"' class='popLinks'>tags</a> and <a href='/photos/id."+id+"' class='popLinks'>more</a></td>";
        }
        sHTML += "</tr>";
        sHTML += "</table>";
        sHTML += "</td>";
        sHTML += "<td align=\"right\" width=\"30%\" style=\"padding-top: 5px;\">";
        sHTML += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\">";
        sHTML += "<tr>";
        sHTML += "<td align=\"right\" style=\"font-family: 'Trebuchet MS', Tahoma, Arial, Verdana,sans-serif;font-size: 18px;color: #4e8dd1;\">See More Photos</td>";
        if(cTagGroup != "")
        {
        sHTML += "<td align=\"right\" width=\"52\"><a href=\"/"+cTagGroup+"/photos/id."+id+"\" ><img src=\"/images/shell/allphotos_pop_btn.gif\" border=\"0\" alt=\"See More Photos\" /></a></td>";
        }
        else
        {
        sHTML += "<td align=\"right\" width=\"52\"><a href=\"/photos/id."+id+"\" ><img src=\"/images/shell/allphotos_pop_btn.gif\" border=\"0\"  alt=\"See More Photos\" /></a></td>";
        }
        sHTML += "</tr>";
        sHTML += "</table>";
        sHTML += "</td>";
        sHTML += "</tr>";
        sHTML += "</table>";
        sHTML += "</td>";
        sHTML += "</tr>";
        sHTML += "<tr><td height='10'></td></tr>";
        sHTML += "</table>";


		divObj.innerHTML = sHTML;

		}
	}
}

function preloaderExperts(imgObj,content,caption,credit,divHeight,id,url)
{
	var creditToShow = '';
	var browser = findBrowser();
	/*************************************/
	/** grabs the created container
	** and replaces its content
	**/
	var divObj = document.getElementById("overlay_div");

	var maxSize = xDocSize();

	if(browser == "FF" || browser == "SAF" || browser == "OP" )
	{
		var topOffset = window.pageYOffset;
	}
	else if(browser == "IE")
	{
		var topOffset = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
	}

	if(credit != "")
	{
	 var creditToShow = credit;
	}

	if(imgObj.complete)
	{
		var maxSize = xDocSize();
		boxY = Math.round((maxSize[0]/2) - (imgObj.width/2));

		var tableWidth = imgObj.width+"px";

		/**
		** the +100 in height adds the space for the caption
		**/

		divObj.style.width = imgObj.width+"px";
 	    //divObj.style.height= imgObj.height+100+"px";
		divObj.style.top = topOffset+30+"px";
		divObj.style.left = (boxY-20)+"px";

		/**
		** this is the output for the popup
		** if its already preloaded
		**/

		/*var sHTML = "<table border='0' width='"+tableWidth+"' cellpadding='0' cellspacing='0' valign='top'>";
		sHTML += "<tr><td align='right'>";
		sHTML += "<table border='0' cellpadding='0' cellspacing='0'><tr><td align='right' class='closePop'>Close</td>"
		sHTML += "<td align='right'><a href='javascript:void(0);' onClick='destroyWindows();'><img src=\"/images/shell/photopop_close_btn.gif\" border=\"0\" /></a></td></tr>"
		sHTML += "</table></td></tr><tr><td height='10'></td></tr>";
		sHTML += "<tr><td align='center'><img src='http://cdn.visitflorida.com/images/photos/"+content+"' style='border: 1px #7fa6e4 solid;'></td></tr>";
		sHTML += "<tr><td height='7'></td></tr><tr><td align='left' valign='top'>";
		sHTML += "<tr><td align='left' class='popCaption'>"+caption+"</td></tr>"+creditToShow+"<tr><td height='7'></td></tr>";
		sHTML += "<tr><td style='background-image: url(/images/shell/blueline_repeat.gif); background-repeat: repeat-x;height: 1px;'></td></tr>";
		sHTML += "<tr><td height='10'></td></tr><tr><td align='left' class='popLinks'>See: <a href='/"+cTagGroup+"/photos/id."+id+"' class='popLinks'>comments</a>, <a href='/"+cTagGroup+"/photos/id."+id+"' class='popLinks'>tags</a> and <a href='/"+cTagGroup+"/photos/id."+id+"' class='popLinks'>more</a></td></tr><tr><td height='10'></td></tr></table>";*/


		var sHTML = "<table border=\"0\" cellpadding=\"0\" width='"+tableWidth+"' cellspacing=\"0\">";
        sHTML += "<tr>";
        sHTML += "<td align=\"right\">";
        sHTML += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
        sHTML += "<tr>";
        sHTML += "<td align=\"right\" class=\"closePop\">Close</td>";
        sHTML += "<td align=\"right\"><a href=\"javascript:void(0);\" onClick=\"destroyWindows();\"><img src=\"/images/shell/photopop_close_btn.gif\" border=\"0\" /></a></td>";
        sHTML += "</tr>";
        sHTML += "</table>";
        sHTML += "</td>";
        sHTML += "</tr>";
        sHTML += "<tr>";
        sHTML += "<td height=\"10\"></td>";
        sHTML += "</tr>";
        sHTML += "<tr>";

        if(content.indexOf('/') == -1)
          content = "http://cdn.visitflorida.com/images/photos/"+content;
        sHTML += "<td align=\"center\"><img src=\""+content+"\" style=\"border: 1px #7fa6e4 solid;\"></td>";
        sHTML += "</tr>";
        sHTML += "<tr>";
        sHTML += "<td height=\"7\"></td>";
        sHTML += "</tr>";
        sHTML += "<tr>";
        sHTML += "<td align=\"left\" valign=\"top\">";
        sHTML += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
        sHTML += "<tr>";
        sHTML += "<td align=\"left\" valign=\"top\" width=\"70%\">";
        sHTML += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
        sHTML += "<tr>";
        sHTML += "<td align=\"left\" valign=\"top\" class='popCaption'>"+caption+"</td>";
        sHTML += "</tr>";
        sHTML += "<tr>";
        if(creditToShow != "")
        {
         sHTML += "<td align='left' class='popCredit'>Photo By: "+credit+"</td>";
        }
        else
        {
         sHTML += "<td height=\"5\"></td>";
        }

        sHTML += "</tr>";
        sHTML += "<tr><td height='10'></td></tr>";
        sHTML += "<tr>";
        sHTML += "<td style='background-image: url(/images/shell/blueline_repeat.gif); background-repeat: repeat-x;height: 1px;'></td>";
        sHTML += "</tr>";
        sHTML += "<tr><td height='10'></td></tr>";
        sHTML += "<tr>";

        if(url == undefined || url.length == 0)
          url = "/photos/id."+id;
        sHTML += "<td align=\"left\" class=\"popLinks\">See: <a href=\""+url+"\" class=\"popLinks\">comments</a>, <a href=\""+url+"\" class='popLinks'>tags</a> and <a href=\""+url+"\" class='popLinks'>more</a></td>";
        sHTML += "</tr>";
        sHTML += "</table>";
        sHTML += "</td>";
        sHTML += "<td align=\"right\" width=\"30%\" style=\"padding-top: 5px;\">";
        sHTML += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\">";
        sHTML += "<tr>";
        sHTML += "<td align=\"right\" style=\"font-family: 'Trebuchet MS', Tahoma, Arial, Verdana,sans-serif;font-size: 18px;color: #4e8dd1;\">See More Photos</td>";
        sHTML += "<td align=\"right\" width=\"52\"><a href=\""+url+"\"><img src=\"/images/shell/allphotos_pop_btn.gif\" border=\"0\"  alt=\"See More Photos\" /></a></td>";
        sHTML += "</tr>";
        sHTML += "</table>";
        sHTML += "</td>";
        sHTML += "</tr>";
        sHTML += "</table>";
        sHTML += "</td>";
        sHTML += "</tr>";
        sHTML += "<tr><td height='10'></td></tr>";
        sHTML += "</table>";


		divObj.innerHTML = sHTML;
//		divObj.innerHTML += "<tr><td align='right'><table border='0' cellpadding='0' cellspacing='0'><tr><td align='right'>close</td><td align='right'><a href='javascript:void(0);' onClick='destroyWindows();'><img src=\"/images/shell/photopop_close_btn.gif\" border=\"0\" /></a></td></tr></table></td></tr>";
	//	divObj.innerHTML += "<tr><td height='20'></td></tr>";
	//	divObj.innerHTML += "<tr><td align='center'><img src='http://cdn.visitflorida.com/images/photos/"+content+"' style='border: 1px #7fa6e4 solid;'></td></tr>";
	//	divObj.innerHTML += "<tr><td height='10'></td></tr>";
	//	divObj.innerHTML += "<tr><td style='padding-left: 5px;'>"+caption+"</td></tr></table>";

	}
	else
	{
		imgObj.onload = function()
		{
			var maxSize = xDocSize();
			boxY = Math.round((maxSize[0]/2) - (imgObj.width/2));

			var tableWidth = imgObj.width+"px";

			/**
			** the +100 in height adds the space for the caption
			**/

			divObj.style.width = imgObj.width+"px";
			//divObj.style.height= imgObj.height+100+"px";
			divObj.style.top = topOffset+30+"px";
			divObj.style.left = (boxY-20)+"px";

			/**
			** this is the output for the popup
			** if its loading for the first time
			**/

		/*var sHTML = "<table border='0' width='"+tableWidth+"' cellpadding='0' cellspacing='0' valign='top'>";
		sHTML += "<tr><td align='right'>";
		sHTML += "<table border='0' cellpadding='0' cellspacing='0'><tr><td align='right' class='closePop'>Close</td>"
		sHTML += "<td align='right'><a href='javascript:void(0);' onClick='destroyWindows();'><img src=\"/images/shell/photopop_close_btn.gif\" border=\"0\" /></a></td></tr>"
		sHTML += "</table></td></tr><tr><td height='10'></td></tr>";
		sHTML += "<tr><td align='center'><img src='http://cdn.visitflorida.com/images/photos/"+content+"' style='border: 1px #7fa6e4 solid;'></td></tr>";
		sHTML += "<tr><td height='7'></td></tr><tr><td align='left' valign='top'>";
		sHTML += "<tr><td align='left' class='popCaption'>"+caption+"</td></tr>"+creditToShow+"<tr><td height='7'></td></tr>";
		sHTML += "<tr><td style='background-image: url(/images/shell/blueline_repeat.gif); background-repeat: repeat-x;height: 1px;'></td></tr>";
		sHTML += "<tr><td height='10'></td></tr><tr><td align='left' class='popLinks'>See: <a href='/"+cTagGroup+"/photos/id."+id+"' class='popLinks'>comments</a>, <a href='/"+cTagGroup+"/photos/id."+id+"'' class='popLinks'>tags</a> and <a href='/"+cTagGroup+"/photos/id."+id+"'' class='popLinks'>more</a></td></tr><tr><td height='10'></td></tr></table>";
		*/
		var sHTML = "<table border=\"0\" cellpadding=\"0\" width='"+tableWidth+"' cellspacing=\"0\">";
        sHTML += "<tr>";
        sHTML += "<td align=\"right\">";
        sHTML += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
        sHTML += "<tr>";
        sHTML += "<td align=\"right\" class=\"closePop\">Close</td>";
        sHTML += "<td align=\"right\"><a href=\"javascript:void(0);\" onClick=\"destroyWindows();\"><img src=\"/images/shell/photopop_close_btn.gif\" border=\"0\" /></a></td>";
        sHTML += "</tr>";
        sHTML += "</table>";
        sHTML += "</td>";
        sHTML += "</tr>";
        sHTML += "<tr>";
        sHTML += "<td height=\"10\"></td>";
        sHTML += "</tr>";
        sHTML += "<tr>";
        sHTML += "<td align=\"center\"><img src=\"http://cdn.visitflorida.com/images/photos/"+content+"\" style=\"border: 1px #7fa6e4 solid;\"></td>";
        sHTML += "</tr>";
        sHTML += "<tr>";
        sHTML += "<td height=\"7\"></td>";
        sHTML += "</tr>";
        sHTML += "<tr>";
        sHTML += "<td align=\"left\" valign=\"top\">";
        sHTML += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
        sHTML += "<tr>";
        sHTML += "<td align=\"left\" valign=\"top\" width=\"70%\">";
        sHTML += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
        sHTML += "<tr>";
        sHTML += "<td align=\"left\" valign=\"top\" class='popCaption'>"+caption+"</td>";
        sHTML += "</tr>";
        sHTML += "<tr>";
        if(creditToShow != "")
        {
         sHTML += "<td align='left' class='popCredit'>Photo By: "+credit+"</td>";
        }
        else
        {
         sHTML += "<td height=\"5\"></td>";
        }

        sHTML += "</tr>";
        sHTML += "<tr><td height='10'></td></tr>";
        sHTML += "<tr>";
        sHTML += "<td style='background-image: url(/images/shell/blueline_repeat.gif); background-repeat: repeat-x;height: 1px;'></td>";
        sHTML += "</tr>";
        sHTML += "<tr><td height='10'></td></tr>";
        sHTML += "<tr>";
        sHTML += "<td align=\"left\" class=\"popLinks\">See: <a href=\"/photos/id."+id+"\" class=\"popLinks\">comments</a>, <a href=\"/photos/id."+id+"\" class='popLinks'>tags</a> and <a href=\"/photos/id."+id+"\" class='popLinks'>more</a></td>";
        sHTML += "</tr>";
        sHTML += "</table>";
        sHTML += "</td>";
        sHTML += "<td align=\"right\" width=\"30%\" style=\"padding-top: 5px;\">";
        sHTML += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\">";
        sHTML += "<tr>";
        sHTML += "<td align=\"right\" style=\"font-family: 'Trebuchet MS', Tahoma, Arial, Verdana,sans-serif;font-size: 18px;color: #4e8dd1;\">See More Photos</td>";
        sHTML += "<td align=\"right\" width=\"52\"><a href=\"/photos/id."+id+"\" ><img src=\"/images/shell/allphotos_pop_btn.gif\" border=\"0\"  alt=\"See More Photos\" /></a></td>";
        sHTML += "</tr>";
        sHTML += "</table>";
        sHTML += "</td>";
        sHTML += "</tr>";
        sHTML += "</table>";
        sHTML += "</td>";
        sHTML += "</tr>";
        sHTML += "<tr><td height='10'></td></tr>";
        sHTML += "</table>";


		divObj.innerHTML = sHTML;

		}
	}
}


function createTopDiv(message,containerWidth,containerHeight,type,caption,credit,id)
{
	var browser = findBrowser();

	if(type == "image")
	{
		var newImage = new Image();
		newImage.src = "http://cdn.visitflorida.com/images/photos/"+message;

		/**
		** standard width and height if not an image
		**/
		var divWidth = 200;
		var divHeight = 300;
	}
	else
	{
		var divWidth = containerWidth;
		var divHeight = containerHeight;
	}
	if(browser == "FF" || browser == "SAF" || browser == "OP" )
	{
		var topOffset = window.pageYOffset;
	}
	else if(browser == "IE")
	{
		var topOffset = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;

	}

	var docObj = document.getElementById("main_body");
	var topDiv = document.createElement('div');
	var maxSize = xDocSize();

	boxY = Math.round((maxSize[0]/2) - (divWidth/2));

	topDiv.style.width = divWidth+"px";
	//topDiv.style.height = divHeight+"px";

	topDiv.style.zIndex = "11000";
	topDiv.setAttribute("id","overlay_div");
	topDiv.style.position = "absolute";
	topDiv.style.top = topOffset+30+"px";
	topDiv.style.left = (boxY-20)+"px";
	topDiv.style.backgroundColor = "#fff";
	topDiv.style.border = "1px black solid";
	topDiv.style.paddingLeft = "20px";
	topDiv.style.paddingRight = "20px";
	topDiv.style.paddingTop = "10px";
	topDiv.style.paddingBottom = "10px";
	topDiv.style.visibility = "visible";
	/*if(type ==  "image")
	{
	topDiv.innerHTML = "<table border='0' width="+divWidth+" cellpadding='0' cellspacing='0' valign='top'><tr><td align='right'><a href='javascript:void(0);' onClick='destroyWindows();'>X</a></td></tr></table>";
	topDiv.innerHTML += "<table border='0' align='center'><tr><td><img src='http://cdn.visitflorida.com/images/photos/"+message+"' border='0'></td></tr></table>";
	}*/
	/*else
	{*/


	/*To check whether golfing or non golfing page*/
	var str = window.location.href;
	var reg = new RegExp("/golfing/");
	if (reg.test(str))
	{
		var image = "/images/shell/golfing/golf_photopop_close_btn.gif";
		var closetext = "";
	}
	else
	{
		var image = "/images/shell/photopop_close_btn.gif";
		var closetext = "<span class='closePop'>Close</span>&nbsp;";
	}

	if(type == "image")
	{
		var preLoadingWin = "<table border='0' width="+divWidth+" cellpadding='0' cellspacing='0' valign='top'><tr><td align='right'><a href='javascript:void(0);' onClick='destroyWindows();'>"+closetext+"<img src='"+image+"' border=\"0\" /></a></td></tr>";
		preLoadingWin += "<tr><td height=\"10\"></td></tr>";
		preLoadingWin += "<tr><td align='center'><img src='/images/shell/loading_transparent.gif' border='0'></td></tr></table>";
		topDiv.innerHTML = preLoadingWin;
		docObj.appendChild(topDiv);
		preloader(newImage,message,caption,credit,divHeight,id);
	}
	else if(type == "generic")
	{
		topDiv.innerHTML = "<table border='0' width="+divWidth+" cellpadding='0' cellspacing='0' valign='top'><tr><td align='right'><a href='javascript:void(0);' onClick='destroyWindows();'><img src='"+image+"' border=\"0\" /></a></td></tr></table>";
		topDiv.innerHTML += "<table border='0' align='center' style='padding-top: 5px;'><tr><td align='center'>"+message+"</td></tr></table>";
		docObj.appendChild(topDiv);
	}
	else if(type == "generic_left")
	{
		topDiv.innerHTML = "<table border='0' width="+divWidth+" cellpadding='0' cellspacing='0' valign='top'><tr><td align='right'><a href='javascript:void(0);' onClick='destroyWindows();'><img src='"+image+"' border=\"0\" /></a></td></tr></table>";
		topDiv.innerHTML += "<table border='0' align='center' style='padding-top: 5px;'><tr><td>"+message+"</td></tr></table>";
		docObj.appendChild(topDiv);
	}
	else if(type == "photo_contest")
	{
		topDiv.innerHTML = "<table border='0' width="+divWidth+" cellpadding='0' cellspacing='0' valign='top'><tr><td align='right'><a href='javascript:void(0);' onClick='destroyWindows();'><img src='"+image+"' border=\"0\" onload=\"setTimeout('setShareThisPos()',1000)\"></a></td></tr></table>";
		topDiv.innerHTML += "<table border='0' align='center' style='padding-top: 5px;'><tr><td>"+message+"</td></tr></table>";
		topDiv.innerHTML +='<table border="0" align="left" style="padding-top: 5px;"><tr><td valign="middle" align="left" style="padding-left: 5px;"><span style="font-family:Tahoma, Arial, Helvetica, sans-serif; font-size:11px; font-weight:bold; color:#999999; line-height:14px; text-decoration:none;"><div id="sharethisreplace" style="position:relative; visibility:hidden">Share this &amp;&amp;&amp;</div></span> </td><td valign="middle" align="left" ><a href="/forward_to_friend/type.contest/"><img src="/images/shell/article_grey_fwd.gif" border="0" id="" /></a></td><td><a href="/forward_to_friend/type.contest/" class="photoStripLink">Forward To a Friend</a></td></tr></table>';
		if(document.getElementById('grey_mouse_over') != undefined)
		{
			topDiv.setAttribute("onmouseover","setLightBoxValue()");
		}
		 //alert(topDiv.innerHTML);
		docObj.appendChild(topDiv);
	}
	/*}*/
}

function setLightBoxValue()
{
	if(document.getElementById('grey_mouse_over') != undefined)
	{
		document.getElementById('grey_mouse_over').value = 1;
	}
}
/*
 * This function is used to set the share this link over the pop up div.
 * Due to some problem, we could not set the share this link inside topDiv.innerHTML
 * So created a div 'hiddenShare' in a display none mode at the bottom of the
 * phase2.php.
*/
function setShareThisPos(){

	var sharethisRepObj = document.getElementById('sharethisreplace');
	var sharethisObj = document.getElementById('hiddenShare');
	sharethisObj.style.left = eval(findPosX(sharethisRepObj) - 10)+"px";
	sharethisObj.style.top = findPosY(sharethisRepObj)+"px";
	sharethisObj.style.zIndex = "12000";
	sharethisObj.style.display = 'block';
}

/*
* function used to get object x coordinate
*/
function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;

	return curleft;
}

/*
* function used to get object y coordinate
*/
function findPosY(obj)
{
var curtop = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curtop += obj.offsetTop
obj = obj.offsetParent;
}
}
else if (obj.y)
curtop += obj.y;
return curtop;
}

function createTopDivExperts(message,containerWidth,containerHeight,type,caption,credit,id,url)
{
	var browser = findBrowser();

	if(type == "image")
	{
		var newImage = new Image();
    if(message.indexOf('/') == -1)
      newImage.src = "http://cdn.visitflorida.com/images/photos/"+message;
    else
      newImage.src = message;

		/**
		** standard width and height if not an image
		**/
		var divWidth = 200;
		var divHeight = 300;
	}
	else
	{
		var divWidth = containerWidth;
		var divHeight = containerHeight;
	}

	if(browser == "FF" || browser == "SAF" || browser == "OP" )
	{
		var topOffset = window.pageYOffset;
	}
	else if(browser == "IE")
	{
		var topOffset = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;

	}

	var docObj = document.getElementById("main_body");
	var topDiv = document.createElement('div');

	var maxSize = xDocSize();

	boxY = Math.round((maxSize[0]/2) - (divWidth/2));

	topDiv.style.width = divWidth+"px";
	//topDiv.style.height = divHeight+"px";

	topDiv.style.zIndex = "11000";
	topDiv.setAttribute("id","overlay_div");
	topDiv.style.position = "absolute";
	topDiv.style.top = topOffset+30+"px";
	topDiv.style.left = (boxY-20)+"px";
	topDiv.style.backgroundColor = "#fff";
	topDiv.style.border = "1px black solid";
	topDiv.style.paddingLeft = "20px";
	topDiv.style.paddingRight = "20px";
	topDiv.style.paddingTop = "10px";
	topDiv.style.paddingBottom = "10px";
	topDiv.style.visibility = "visible";
	/*if(type ==  "image")
	{
	topDiv.innerHTML = "<table border='0' width="+divWidth+" cellpadding='0' cellspacing='0' valign='top'><tr><td align='right'><a href='javascript:void(0);' onClick='destroyWindows();'>X</a></td></tr></table>";
	topDiv.innerHTML += "<table border='0' align='center'><tr><td><img src='http://cdn.visitflorida.com/images/photos/"+message+"' border='0'></td></tr></table>";
	}*/
	/*else
	{*/

	if(type == "image")
	{
		var preLoadingWin = "<table border='0' width="+divWidth+" cellpadding='0' cellspacing='0' valign='top'><tr><td align='right'><a href='javascript:void(0);' onClick='destroyWindows();'><span class='closePop'>Close</span>&nbsp;<img src=\"/images/shell/photopop_close_btn.gif\" border=\"0\" /></a></td></tr>";
		preLoadingWin += "<tr><td height=\"10\"></td></tr>";
		preLoadingWin += "<tr><td align='center'><img src='/images/shell/loading_transparent.gif' border='0'></td></tr></table>";
		topDiv.innerHTML = preLoadingWin;
		docObj.appendChild(topDiv);
		preloaderExperts(newImage,message,caption,credit,divHeight,id,url);
	}
	else if(type == "generic")
	{
		topDiv.innerHTML = "<table border='0' width="+divWidth+" cellpadding='0' cellspacing='0' valign='top'><tr><td align='right'><a href='javascript:void(0);' onClick='destroyWindows();'><img src=\"/images/shell/photopop_close_btn.gif\" border=\"0\" /></a></td></tr></table>";
		topDiv.innerHTML += "<table border='0' align='center' style='padding-top: 5px;'><tr><td align='center'>"+message+"</td></tr></table>";
		docObj.appendChild(topDiv);
	}

	/*}*/
}


function createFileDiv(FormName,FormAction,userFile,containerWidth,containerHeight)
{
	var browser = findBrowser();

	var divWidth = containerWidth;
	var divHeight = containerHeight;

	if(browser == "FF" || browser == "SAF" || browser == "OP" )
	{
		var topOffset = window.pageYOffset;
	}
	else if(browser == "IE")
	{
		var topOffset = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;

	}

	var docObj = document.getElementById("main_body");
	var topDiv = document.createElement('div');

	var maxSize = xDocSize();

	boxY = Math.round((maxSize[0]/2) - (divWidth/2));

	topDiv.style.width = divWidth+"px";
	topDiv.style.height = divHeight+"px";

	topDiv.style.zIndex = "11000";
	topDiv.setAttribute("id","overlay_div");
	topDiv.style.position = "absolute";
	topDiv.style.top = topOffset+30+"px";
	topDiv.style.left = (boxY-20)+"px";
	topDiv.style.backgroundColor = "#fff";
	topDiv.style.border = "1px solid black";
	topDiv.style.visibility = "visible";

	topDiv.innerHTML  = "<form method='post' name='"+FormName+"' action='"+FormAction+"' enctype='multipart/form-data'><table border='0' width="+divWidth+" cellpadding='0' cellspacing='0' valign='top'><tr><td align='right'><a href='javascript:void(0);' onClick='destroyWindows();'>X</a></td></tr><tr><td align='center'><input type=\"file\" name='"+userFile+"' size='20'></td></tr><tr><td align='left'><input type=\"submit\" name='save' value='save'></td></tr></table></form>";

	docObj.appendChild(topDiv);
}

function destroyWindows()
{
	if(document.getElementById('grey_mouse_over') != undefined)
	{
		document.getElementById('grey_mouse_over').value = 0;
	}
	document.getElementById('overlay_div').parentNode.removeChild(document.getElementById('overlay_div'));
	document.getElementById('grey_div').parentNode.removeChild(document.getElementById('grey_div'));
	document.getElementById('hiddenShare').style.display='none';
}

function destroyWindowsOut()
{
	if(document.getElementById('grey_mouse_over') != undefined)
	{
		if(document.getElementById('grey_mouse_over').value == 1)
		{
			document.getElementById('grey_mouse_over').value = 0;
			document.getElementById('overlay_div').parentNode.removeChild(document.getElementById('overlay_div'));
			document.getElementById('grey_div').parentNode.removeChild(document.getElementById('grey_div'));
			document.getElementById('hiddenShare').style.display='none';
		}
	}
}

function refresh_topDiv()
{
	var browser = findBrowser();
	if(browser == "FF" || browser == "SAF" || browser == "OP" )
	{
		var topOffset = window.pageYOffset;
	}
	else if(browser == "IE")
	{
		var topOffset = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
	}

	if(document.getElementById("overlay_div") != null)
	{
		var divWidth = document.getElementById('overlay_div').style.width;
		var t = divWidth.substr(0,divWidth.indexOf('px'));
		var maxSize = xDocSize();

		boxY = Math.round((maxSize[0]/2) - (parseInt(t)/2));

		if(browser == "FF" || browser == "SAF" || browser == "OP" )
		{
			document.getElementById('overlay_div').style.left = (boxY-20)+"px";
			//document.getElementById('overlay_div').style.top = topOffset+30+"px";
		}
		else if(browser == "IE")
		{
			document.getElementById('overlay_div').style.left = (boxY-10)+"px";
			//document.getElementById('overlay_div').style.top = topOffset+30+"px";
		}
	}
}



function findBrowser()
{

	var agt=navigator.userAgent.toLowerCase();

	if(agt.indexOf("msie") != -1)
	{
		return "IE";
	}
	else if(agt.indexOf("firefox") != -1)
	{
		return "FF";
	}
	else if(agt.indexOf("opera") != -1)
	{
		return "OP";
	}
	else if(agt.indexOf("safari") != -1)
	{
		return "SAF";
	}
}
