var srchstatus = 0;
var srchtimer = null;

function srchvalidate()
{
    var t = document.forms[0][0].value;
    if (t.length < 3)
    {
        srchalert();
        return false;
    }
    return true;
}

function showsearch(showlatest)
{
  document.write("<center><table border=0 cellspacing=0 cellpadding=0 background=\'5.gif\'><tr height=42>");
  document.write("<td width=91 align=\'left\' valign=\'top\'><img src=\'5.jpg\'></td>");
  document.write("<td valign=\'top\'><FORM METHOD=POST ACTION=\'code/urlsrch.cgi\' class=\'a\' onsubmit=\'return srchvalidate()\'>");
  document.write("<font style=\'\{ font-family: verdana; font-size: 11px; color: #FFFFFF; \}\'>Find a celebrity on <i>SexyDesktop</i>:</font>");
  document.write("<INPUT NAME=\'searchstring\' SIZE=20 MAXLENGTH=30 type=\'text\' class=\'texta\'></td>");
  document.write("<td align=\'left\'><input type=\'image\' src=\'6.gif\' value=\'Search\' alt=\'Search\'></FORM></td>");
  document.write("<td width=31 background=\'6.jpg\'></td><td valign=\'top\'><FORM class=\'b\'>");
  document.write("<font style=\'\{ font-family: verdana; font-size: 11px; color: #FFFFFF; \}\'>...or, Browse through our alphabetical Babes index </font>");
  document.write("</form></td><td align=\'left\' valign=\'top\'><a href=\'index.htm\'><img src=\'7.gif\' border=0></a></td></tr></table>");
  document.write("</center>");
  document.write("<center><table border=0 cellspacing=0 cellpadding=0 background=\'upload_2.gif\'><tr height=33>");
  document.write("<td width=22 align=\'left\' valign=\'top\'><img src=\'upload_1.gif\'></td>");
  document.write("<td width=14 align=\'left\' valign=\'top\'><img src=\'upload_3.gif\'></td>");
  document.write("<td><font style=\'\{ font-family: verdana; font-size: 11px; color: #FFFFFF; \}\'> &nbsp; &nbsp; <B>NEW!</b> <a style='{ color: #FFFFFF; }' href='upload.htm'>Add links to your own wallpapers</a> <font style='{ color: #E0E0E0; }'>and help SexyDesktop to grow</font> &nbsp; &nbsp; </font>");
  document.write("<td width=14 align=\'left\' valign=\'top\'><img src=\'upload_3.gif\'></td>");
  document.write("<td width=22 align=\'left\' valign=\'top\'><img src=\'upload_4.gif\'></td>");
  document.write("</tr></table></center><br>");
}


function srchalert()
{
	var e_b = document.getElementsByTagName("body")[0];
	var e_d = document.getElementById("srchalert");
	if (e_b != null && e_d == null)
	{
		w = document.body.clientWidth;
		if (w == null) w = 800;
		w = (w - 302) / 2;
		
		e_d = document.createElement("div");
		e_d.setAttribute("id", "srchalert");
		i = 0;
		if (document.documentElement.scrollTop)
			i = document.documentElement.scrollTop;
		else
		{
			if (document.body.scrollTop)
				i = document.body.scrollTop;
			else
			{
				if (window.pageYOffset) i = window.pageYOffset;
			}
		}
		i += 300;
		e_d.style.position="absolute";
		e_d.style.top = i + "px";
		e_d.style.left = w + "px";
		e_d.style.width = "299px";
		e_d.style.borderTop="1px solid #f60";
		e_d.style.borderLeft="1px solid #f60";
		e_d.style.borderRight="2px solid #C95000";
		e_d.style.borderBottom="2px solid #AB4400";
		e_d.style.fontFamily="verdana,sans-serif";
		e_d.style.backgroundColor="#c00";
		e_d.style.fontSize = "10pt";
		e_d.style.margin = "0";
		e_d.style.padding = "0";
		
		e_r = document.createElement("div");
		e_r.style.backgroundColor="#c00";
		e_r.style.color="#fff";
		e_r.style.margin = "0";
		e_r.style.padding = "1px 0 1px 5px";
		e_r.style.width = "295px";
		e_r.appendChild(document.createTextNode("Note:"));
		e_d.appendChild(e_r);

		e_r = document.createElement("div");
		e_r.setAttribute("id", "bmalertmsg");
		e_r.style.borderTop="1px solid #ff6300";
		e_r.style.borderBottom="1px solid #ff6300";
		e_r.style.width = "299px";
		e_r.style.margin = "0";
		e_r.style.padding = "32px 0";
		e_r.style.textAlign = "center";
		e_r.style.fontSize = "11pt";
		e_r.style.backgroundColor="#ffc";
		e_r.appendChild(document.createTextNode("Your search clue must be more than two letters."));
		e_d.appendChild(e_r);
			
		e_r = document.createElement("div");
		e_r.style.backgroundColor="#c00";
		e_r.style.color="#f60";
		e_r.style.margin = "0";
		e_r.style.padding = "2px 5px 1px 0";
		e_r.style.width = "295px";
		e_r.style.textAlign = "right";
		e_r.appendChild(document.createTextNode("SexyDesktop"));
		e_d.appendChild(e_r);

		e_b.appendChild(e_d);
		srchtimer = window.setInterval('srchtimerproc()', 30);
	}
		
	srchstatus = 70;
}

function srchtimerproc()
{
	var ea = document.getElementById("srchalert");
	if (ea == null) return;
	
	if (srchstatus == 1)
	{
		var e_b = document.getElementsByTagName("body")[0];
		e_b.removeChild(ea);
		window.clearInterval(srchtimer);
		srchtimer = null;
		srchstatus = 0;
		return;
	}
	
	if (srchstatus == 2)
	{
		ea.style.opacity = '0.25';
		ea.style.filter='alpha(opacity=25)';
	}
	
	if (srchstatus == 3)
	{
		ea.style.opacity = '0.5';
		ea.style.filter='alpha(opacity=50)';
	}
	
	if (srchstatus == 4)
	{
		ea.style.opacity = '0.7';
		ea.style.filter='alpha(opacity=70)';
	}
	
	srchstatus--;
}

