goinghome=0;

gadmin = ggetCookie("admin_level");
gadmin_links = ggetCookie("display_admin_menu");
gusername = ggetCookie("username");
var thtml='';
baseurl = (typeof(baseurl) !='undefined') ? baseurl : "";
if (typeof(checkoutpage) == 'undefined')
        checkoutpage = 0;
function writesearchbox(){
	
	thtml += '<div style="float: right;margin: 24px 40px 0px 0px; width: auto">';
	thtml += '<form method="get" id="search-form" action="javascript: ghome();" enctype="application/x-www-form-urlencoded" name="qform2">';
	thtml += '	<table border="0" cellpadding="0" cellspacing="0" style="float:left" width="550">';
	thtml += '        <tr>';
	thtml += '            <td width="135" aligh=right><input type="text" name="Keywords" id="Keywordfield" class="input" onfocus="if(this.value==\'enter keywords\')this.value=\'\';" value="enter keywords"  /></td>';
	thtml += '            <td width="53" align="left"><div id="buttonsearch"><a href="javascript:ghome();"></a></div></td>';
	thtml += '            <td width="24"><div id="searchcheckbox"><input type="checkbox" name="searchinclude" value="RM" checked></div></td>';
	thtml += '            <td width="113"><div id="rmlabel">&nbsp;</div><div id="rmindicator">&nbsp;</div></td>';
	thtml += '            <td width="28" align="right"><div id="searchcheckbox"><input type="checkbox" name="searchinclude" value="RF" checked></div></td>';
	thtml += '            <td width="86"><div id="rflabel">&nbsp;</div><div id="rfindicator">&nbsp;</div></td>';
	thtml += '            <td width="28" align="right"><div id="searchcheckbox"><input type="checkbox" name="vintage" value="GHIV" checked=""></div></td>';
	thtml += '            <td width="70"><div id="vintagelabel">&nbsp;</div></td>';
	thtml += '        </tr>';
	thtml += '	</table>';
	thtml += '</form>';
	thtml += '</div>';
}

/////// admin bar inline ///////
if(gadmin && gadmin_links && gusername && gsession)
{
		thtml +='<div id=navbar><div id=navbar_enclosure><font class=adminlabel>&nbsp;ADMIN:</font> <a href="' + baseurl + '/" target="left" class="adminlink">Homepage</a> | ';
		//write in the navbar here;
		if (gadmin_links && gadmin_links.toString().length > 1) //also have additional links to parse
		{
				var tnavObjs = eval(''+gadmin_links+'');
				for (i=0;i< tnavObjs.length;i++){
					thtml +='<a href="' + tnavObjs[i]['lnk'] + '" class=adminlink>' + tnavObjs[i]['txt'] + '</a> | ';
				}
		}
		thtml +='</div></div><div style="height: 30px;">&nbsp;</div>';
setTimeout("document.getElementById('searchmore').style.top='76px';",6000);
}
function welcomebits(){
        /////////////////////// conditional row of welcome bits //////
        if((gsession && gusername) || checkoutpage==1) {
                thtml += '<div id="rightindentorwide">';
                thtml += '		<div id="navsignout" class="navblocks"><a href="jav' + 'ascript: gsetCookie2\(\'username\',\'\'\);gsetCookie2\(\'gmpsess\',\'\'\);gsetCookie2\(\'gmpauth\',\'\'\);top.location=\'/index.shtml\';\"></a></div>';
                thtml += '		<div id="navdownld" class="navblocks"><a href=' + baseurl + '/tools/DDload?supst=glasshouse class="nav"></a></div>';
                thtml += '		<div id="navaccount" class="navblocks"><a href=' + baseurl + '/bin/Profile class="nav"></a></div>';
                thtml += '		<div id="welcomeblock" class="navblocks">Welcome back ' + gusername + '</div>';
				thtml +='</div>';

        } else {
                thtml += '<div id="rightindentor">';
                thtml += '                        <div id=navlogin class="navblocks"><a href="' + baseurl + '/user/login.shtml"></a></div>';
				thtml +='</div>';
        }
}

/////////////////////////////
function ghome() {
	if(goinghome==1){
	} else {
		gsetCookie("gwhichstartpage","", "", "/", gGetCookieDom());
		var theurl='';
		var gurl = document.qform2.Keywords.value + '';
		if(!document.qform2.vintage.checked) {theurl+='+not+GHIV'} else { if(!document.qform2.searchinclude[0].checked && !document.qform2.searchinclude[1].checked){ theurl+='+and+GHIV'; }   };	
		if(document.qform2.searchinclude[0].checked){theurl += '&searchinclude=RM';}
		if(document.qform2.searchinclude[1].checked){theurl += '&searchinclude=RF';}


		var theurl= baseurl + '/SwishSearch?Keywords=' + gurl + theurl ;
		self.location='' + theurl;
		goinghome=1;
	}
}

function clearsubnav(){
	MM_setTextOfLayer('navlayer','','');
}

if(typeof(gsession) == 'undefined')
        gsession = '';
if(typeof(gusername) == 'undefined')
        gusername = '';

/////////////////////// cover

thtml +='<div id="fade_cover" style="display: ';
if(String(self.location.href).indexOf('faded')>0){
	thtml +='block';
	setTimeout('fade_in_cover()',700);//fade from white
} else {
	thtml +='none';
}
thtml+=';"> </div>';

/////////////////////// first row of nav //////
if(typeof(dsplkys) == 'undefined' && typeof(navwidepage) == 'undefined'){
	thtml += '<div id="doc3">';
	if(typeof(hidenavhd) == 'undefined'){
		thtml += '        <div id="hd"><div id="header_con">';
		thtml += '                <div id="logo_primary"><a href="' + baseurl + '/" target=_top><img src="/graphics/spacer.gif" height=55 width=270 border=0></a></div>';
		writesearchbox();
		thtml += '                 <div id="navbuttoncontainer"><div id="leftindentor"><table width=100%><tr><td align=left width=80% valign="top"><div id="navbuttonsleft"><nobr>';
		thtml += '                        <div id=navhome class="navblocks"><a href="' + baseurl + '/"></a></div>';
		thtml += '                        <div id=navnews class="navblocks"><a href="' + baseurl + '/news_front.shtml"></a></div>';
		thtml += '                        <div id=navgalleries class="navblocks"><a href="' + baseurl + '/gallery_front.shtml"></a></div>';
		thtml += '                        <div id=navphotographers class="navblocks"><a href="' + baseurl + '/photographer_front.shtml"></a></div>';
		thtml += '                        <div id=navadvancedsearch class="navblocks"><a href="' + baseurl + '/user/search_advanced.shtml"></a></div>';
		thtml += '                        <div id=navlightbox class="navblocks"><a href="' + baseurl + '/SwishSearch?n=1&lb_view=1"></a></div>';
		thtml += '                        <div id=navcart class="navblocks"><a href="javascript:topcartrefresh();"></a></div>';
		thtml += '                        <div id=navabout class="navblocks"><a href="' + baseurl + '/aboutus_mission.shtml"></a></div>';
		thtml += '                        <div id=navcontact class="navblocks"><a href="' + baseurl + '/contact.shtml"></a></div>';
//		thtml += '                        <div id=navhelp class="navblocks"><a href="' + baseurl + '/help_starthere.shtml"></a></div>';
		thtml += '                        <div id=navblog class="navblocks"><a href="http://stone-thrower.com/" target="blog"></a></div>';
		thtml += '                        <div id=navdivider class="navblocks">&nbsp;</div>';
		thtml += '                        <div id=navglasshouseassignment class="navblocks"><a href="http://www.glasshouseassignment.com/" target="other"></a></div>';
		thtml += '                </nobr></div></td><td align=right>';
		thtml += ' 				  <div id="navbuttonsright">';
		welcomebits();

		thtml += '				  </div></td></tr></table></div></div>';
		thtml += '                </div>';
		thtml += '        </div>';
	}
	thtml += '        <div id="bd"><div class="bodycontent">';
} else {
	//search results page
	thtml += '<div id="doc3">';
	thtml += '        <div id="hd"><div id="header_con">';
	thtml += '                <div id="logo_primary"><a href="' + baseurl + '/" target=_top><img src="/graphics/spacer.gif" height=55 width=27 border=0></a></div>';
		writesearchbox();
		thtml += '                 <div id="navbuttoncontainer"><div id="leftindentor"><table width=100%><tr><td align=left width=80%  valign="top"><div id="navbuttonsleft"><nobr>';
		thtml += '                        <div id=navhome class="navblocks"><a href="' + baseurl + '/"></a></div>';
		thtml += '                        <div id=navnews class="navblocks"><a href="' + baseurl + '/news_front.shtml"></a></div>';
		thtml += '                        <div id=navgalleries class="navblocks"><a href="' + baseurl + '/gallery_front.shtml"></a></div>';
		thtml += '                        <div id=navphotographers class="navblocks"><a href="' + baseurl + '/photographer_front.shtml"></a></div>';
		thtml += '                        <div id=navadvancedsearch class="navblocks"><a href="' + baseurl + '/user/search_advanced.shtml"></a></div>';
		thtml += '                        <div id=navlightbox class="navblocks"><a href="' + baseurl + '/SwishSearch?n=1&lb_view=1"></a></div>';
		thtml += '                        <div id=navcart class="navblocks"><a href="javascript:topcartrefresh();"></a></div>';
		thtml += '                        <div id=navabout class="navblocks"><a href="' + baseurl + '/aboutus_mission.shtml"></a></div>';
		thtml += '                        <div id=navcontact class="navblocks"><a href="' + baseurl + '/contact.shtml"></a></div>';
//		thtml += '                        <div id=navhelp class="navblocks"><a href="' + baseurl + '/help_starthere.shtml"></a></div>';
		thtml += '                        <div id=navblog class="navblocks"><a href="http://stone-thrower.com/" target="blog"></a></div>';
		thtml += '                        <div id=navdivider class="navblocks">&nbsp;</div>';
		thtml += '                        <div id=navglasshouseassignment class="navblocks"><a href="http://www.glasshouseassignment.com/" target="other"></a></div>';

		thtml += '                </nobr></div></td><td align=right>';
		thtml += ' 				  <div id="navbuttonsright">';
		welcomebits();

		thtml += '				  </div></td></tr></table></div></div>';
		thtml += '                </div>';
		thtml += '        </div>';
	thtml += '        <div id="bdresults"><div class="yui-g">';
	
}

/////////////////////// second row of nav //////

//thtml += '<table cellspacing="0" cellpadding="0" border="0" width="100%" height=15 style="background: #7f8cb8;background: url(/graphics/barbg.gif) repeat-x;margin-top: 0px;"><tr>';


/////////////////////// conditional row of welcome bits //////
 
if(gsession && gusername) {
//	thtml += '<td valign=top align="left" style="padding-left:15px;">';
//	thtml += '<DIV style="padding-top: 4px;margin-bottom: 4px; color: #ffffff;">';
//	thtml += 'Welcome back ' + gusername);
//	if (typeof(gcartimages) != 'undefined'){
//		thtml += '&nbsp;&nbsp;<A href="javascr' + 'ipt:topcartrefresh();" class=nav>images in cart &rarr; Checkout</A>';
//	}
//	thtml += '&nbsp;&nbsp;&nbsp;</B><nobr><A HREF=/bin/Profile class=nav>account</A>';
//	thtml += '&nbsp;&nbsp;&nbsp;<A HREF=/tools/DDloadi?supst=glasshouse class=nav >downloads</A>';
//	thtml += '&nbsp;&nbsp;&nbsp;<A HREF="jav' + 'ascript: gsetCookie2\(\'username\',\'\'\);gsetCookie2\(\'gmpsess\',\'\'\);gsetCookie2\(\'gmpauth\',\'\'\);top.location=\'/index.shtml\';\" class=nav>sign-out</A>';
//	thtml += '</div></td>';
//	thtml += '<td align="right" style="padding-right:15px;">';
//	thtml += '<table cellspacing="0" cellpadding="0" border="0" align="right"><tr>';
} else {	

//	thtml += '<td align="right" style="padding-right:15px;">';
//	thtml += '<table cellspacing="0" cellpadding="0" border="0" align="right"><tr>';
//	thtml += '<td align=right class=navbox><a class=nav href="/user/login.shtml">login/register</a></td>';
}

	
///////////////////// end of row 2////////////
//thtml += '<table cellspacing="0" cellpadding="0" border="0" width="100%" height=13 style="margin-top: 0px;"><tr><td align=right>';
thtml += '<iframe id="RSIFrame" name="RSIFrame" style="width:0px; height:0px; border: 0px" src=nothing.html></iframe>';
//	thtml += '<div align="right" id="navlayer" style="width:750px; height:13px; z-index:1;padding-top: 3px;text-align:right;padding-right: 15px;"></div>';
//thtml += '</td></tr></table>';

document.write(thtml);

