goinghome=0;

gadmin = ggetCookie("admin_level");
gadmin_links = ggetCookie("display_admin_menu");
gusername = ggetCookie("username");

gsuggest = ggetCookie("gsuggest");

var gfirstname = ggetCookie("firstname");
var suggest = new Array();

var thtml='';
var baseurl = "http://www.antphoto.com.au";
//testing for old searches/
var gpsearches = ggetCookie('psearches');
gpsearches = unescape(gpsearches);
if(gpsearches){
	priorsearcharray = gpsearches.split('|');
	if (priorsearcharray[priorsearcharray.length-1] && priorsearcharray[priorsearcharray.length-1].length > 5){
		youhaveoldsearches=priorsearcharray[priorsearcharray.length-1].split('~')[0];
	}

}
function lastresults(){
	if(typeof(youhaveoldsearches) != 'undefined' && youhaveoldsearches.length > 10){
		self.location='/SwishSearch?'+ youhaveoldsearches;
	}
}
function suggestion_panel(){
	var sughtml = "";
	sughtml += '<div id="suggestion_panel"><form name="qsug" method="get">';
	//document.write('<div id="suggestion_panel_inner">Keyword from the <u>ANT Collection</u></div>');
	sughtml += '<div id="suggestion_panel_inner">&nbsp;Keywords from the ANT collection&nbsp;&nbsp;<a href="javascript:return false;" onclick="javascript:suggestionClose(\'suggestion_panel\',\'suggestion_panel_box\')"  style="text-decoration:none;color:#fff;">X</a></div>';
//+'<span style="margin-left:80px"><a href="javascript:return false;" onclick="javascript:suggestionClose(\'suggestion_panel\',\'suggestion_panel_box\')"  style="text-decoration:none;color:#fff;">X</a></span></div>';
	sughtml += '<div id="suggestion_panel_box"></div>';
	if(typeof(dsplkys) != 'undefined'){
		sughtml += '<div id="suggestion_panel_inner"><input type="checkbox" name="searchmethod">within results</div>';
	}
	sughtml += '</form></div>';
	return sughtml;
}

function writesearchbox(){

	var searchhtml = "";	
	searchhtml += '<div id="navbuttons" style="float:left"><div style="float:left">';
	searchhtml += '<form method="get" id="search-form" action="javascript: ghome();" enctype="application/x-www-form-urlencoded" name="qform2">';


if(typeof(dsplkys) == 'undefined' && typeof(navwidepage) == 'undefined' && ( typeof(youhaveoldsearches) != 'undefined' || ( location.href.match(/BetaDDload/)))  ){ // only show if you need to go back to your last results
	searchhtml += '            <div style="width:194px;float:left"><input type="text" name="Keywords" id="Keywordfield" class="input" onfocus="if(this.value==\'enter keywords\')this.value=\'\';" value="enter keywords"  onkeyup="javascript:suggestionBox(this.value,\'suggestion_panel\',\'suggestion_panel_box\');" autocomplete="off" /></div>';
	searchhtml += '            <div id="sbuttongo" style="float:left"><a href="javascript:ghome();"></a></div>';
	if(!( location.href.match(/BetaDDload/)))
		searchhtml += '                		<div id=navbacktoresults class="navblocks" style="float:left"><a href="javascript:lastresults();" target="_top"></a></div><div class="navdivider"> </div>';
	else
		searchhtml += '                		<div id=navhome class="navblocks" style="float:left"><a href="'+baseurl+'/" target="_top"></a></div><div class="navdivider"> </div>';
} 
else {
	searchhtml += '            <div style="width:194px;float:left"><input type="text" name="Keywords" id="Keywordfieldw" class="input" onfocus="if(this.value==\'enter keywords\')this.value=\'\';" value="enter keywords" onkeyup="javascript:suggestionBox(this.value,\'suggestion_panel\',\'suggestion_panel_box\');" autocomplete="off"/></div>';
	searchhtml += '            <div id="sbuttongo" style="float:left"><a href="javascript:ghome();"></a></div>';
	if(typeof(dsplkys) != 'undefined'){
		searchhtml += '<div style="float:left;color:#fff">&nbsp;<input type="checkbox" name="searchmethod" id="sqwithin" style="margin-top:3px"></input></div><div style="margin-top:3px;color:#fff;float:left;width:auto">within results&nbsp;&nbsp;</div>';
	}
}
	searchhtml += '                		<div id=navgalleries class="navblocks" style="float:left"><a href="'+baseurl+'/galleries_front.shtml" target="_top"></a></div><div class="navdivider" style="float:left"></div> ';
	searchhtml += '                	    <div id=navabout class="navblocks" style="float:left"><a href="'+baseurl+'/aboutus_mission.shtml"></a></div>';

	searchhtml += '</form></div>';
	searchhtml +='</div>';
	searchhtml += suggestion_panel();
	return searchhtml;

}

/*
function writesearchbox(){

        var searchhtml = "";
        searchhtml += '<div id="navbuttons"><div style="float:left">';
        searchhtml += '<form method="get" id="search-form" action="javascript: ghome();" enctype="application/x-www-form-urlencoded" name="qform2"';
        searchhtml += '<table border="0" cellpadding="0" cellspacing="0" height=20 >';
        searchhtml += '        <tr>  ';

if(typeof(dsplkys) == 'undefined' && typeof(navwidepage) == 'undefined' && ( typeof(youhaveoldsearches) != 'undefined' || ( location.href.match(/BetaDDload/)) )){ // only show if you need to go back to your last results
        searchhtml += '            <td width="134"><input type="text" name="Keywords" id="Keywordfield" class="input" onfocus="if(this.value==\'enter keywords\')this.value=\'\';" value="enter keywords"  onkeyup="javascript:suggestionBox(this.value,\'suggestion_panel\',\'suggestion_panel_box\');" autocomplete="off" /></td>';
        searchhtml += '            <td width="40"><div id="sbuttongo"><a href="javascript:ghome();" "></a></div></td>';
        searchhtml += '                         <td id=navbacktoresults class="navblocks"><a href="javascript:lastresults();" target="_top"></a></td><td class="navdivider"> </td>';
} else {
        searchhtml += '            <td width="194"><input type="text" name="Keywords" id="Keywordfieldw" class="input" onfocus="if(this.value==\'enter keywords\')this.value=\'\';" value="enter keywords" onkeyup="javascript:suggestionBox(this.value,\'suggestion_panel\',\'suggestion_panel_box\');" autocomplete="off"/></td>';
        searchhtml += '            <td width="40"><div id="sbuttongo"><a href="javascript:ghome();" "></a></div></td>';

}
        searchhtml += '                         <td id=navgalleries class="navblocks"><a href="'+baseurl+'/galleries_front.shtml" target="_top"></a></td><td class="navdivider"> </td>';
        searchhtml += '                     <td id=navabout class="navblocks"><a href="'+baseurl+'/aboutus_mission.shtml"></a></td>';

        searchhtml += '        </tr>';
        searchhtml += '</table></form></div>';
        searchhtml += suggestion_panel();
        searchhtml +='</div>';
        return searchhtml;

}

*/
		thtml += '<div id="loginLayer"></div><div id="loginLayerCover"></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: 13px;">&nbsp;</div>';
//setTimeout("document.getElementById('searchmore').style.top='76px';",6000);
}
function welcomebits(){
        /////////////////////// conditional row of welcome bits //////
        if(gsession && gusername) {
			thtml += '<div id="welcomecontainer"><div id="welcomeblock">Welcome ' + (typeof(gfirstname) != 'undefined'? gfirstname :gusername) + '</div>';
			thtml += '<div id=navaccount class="navblocks"><A HREF='+baseurl+'/bin/Profile class=nav></A></div><div class="navdivider">&nbsp;</div>';
			thtml += '<div id=navsignout class="navblocks"><A HREF="jav' + 'ascript: gsetCookie2\(\'username\',\'\'\);gsetCookie2\(\'gmpsess\',\'\'\);gsetCookie2\(\'gmpauth\',\'\'\);top.location=\'/index.shtml\';\"></A></div><div class="navdivider">&nbsp;</div>';
			//thtml += '                	        <div id=navsearch class="navblocks"><a href="/user/search.shtml"></a></div><div class="navdivider">&nbsp;</div>';
			thtml += '<div id=navlightbox class="navblocks"><a href="'+baseurl+'/SwishSearch?n=1&lb_view=1"></a></div><div class="navdivider">&nbsp;</div>';
			thtml += '<div id=navcart class="navblocks"><a href="javascript:topcartrefresh();"></a></div><div class="navdivider">&nbsp;</div>';
			thtml += '<div id=navdownld class="navblocks"><A HREF=http://delivery.ipnstock.com/bin/BetaDDload?sess_id=' +  gsession + '&supst=antphoto&sphotog=antphoto class=nav ></A></div>';
		thtml+='</div>';

        } else {
		if(typeof(hidewelcome) == 'undefined'){
                thtml += '<div id="welcomecontainer"><div id="welcomeblockloggedout"><a href ="javascript:show_login();">You are logged out</a></div><div class="navdivider">&nbsp;</div>';
                //thtml += '<div id=navlogin class="navblocks"><A HREF="'+baseurl+'/user/login.shtml"></A></div>';
                thtml += '<div id=navlogin class="navblocks"><a href ="javascript:show_login();"></a></div>';
		//thtml += '                	        <div id=navsearch class="navblocks"><a href="/user/search.shtml"></a></div>';
		}
                thtml += '</div>';

        }
}

/////////////////////////////
function ghome() {
	if(goinghome==1){
	} else {
		gsetCookie("gwhichstartpage","", "", "/", gGetCookieDom());
		var gurl = [];
		gurl.push(document.qform2.Keywords.value + '');
		var orient = '';
		var checkList = document.qsug.keywordlist;
		if(typeof checkList != 'undefined'){
			if((typeof checkList  == 'object') && (typeof checkList.length == 'number'))
			{
				gurl = [];
				for(var i=0;i<checkList.length;i++){
					if(checkList[i].checked)
						gurl.push('"'+checkList[i].value+'"');
				}
			}else{
				gurl = [];
				gurl.push(checkList.value);
			}
		}
		if(gurl.length == 0)
			gurl.push(document.qform2.Keywords.value + '');
		var theurl= baseurl+'/SwishSearch?Keywords=' + gurl.join(' OR ') + orient ;

		if((typeof(q_id) != 'undefined') && ((document.qsug.searchmethod.checked) || ($('sqwithin').checked))){
		    q_id = q_id.replace(/&#34;/g,"\"");
		    var temp = [];
		    temp.push(baseurl+"/SwishSearch?Keywords=");
		    temp.push(q_id);
		    temp.push("&ex_keys=");
		    temp.push(gurl.join(' OR '));
		    theurl = temp.join("");
		}

		self.location='' + theurl;
		goinghome=1;
	}
}

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

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


/////////////////////// first row of nav //////
if(typeof(dsplkys) == 'undefined' && typeof(navwidepage) == 'undefined'){
	document.write('<div id="doc3">');
	if(typeof(hidenavhd) == 'undefined'){
		thtml += '        <div id="hd">';
		thtml += '			<div id="header_con">';
		thtml += '                <div id="logo_primary"><a href="'+baseurl+'/" target="_top" id="logo_link"></a><a href="'+baseurl+'/sitemap.shtml" target="_top" id="logo_sitemap_link"></a></div>';
		thtml += '          </div>';
		thtml += '			<div style="clear:both;background: #666 url('+baseurl+'/graphics/bar-bg-white.gif) repeat-x;height:35px;margin-top: 0px;">';
//		thtml += '			<div style="background: #666 url(/graphics/bar-bg.gif) repeat-x;height:35px;margin-top: 0px;">';
		thtml += '				<table width=100% height=20 width=100% ><tr><td align=left ><nobr>';
		thtml += writesearchbox();
		thtml += '				</td><td align=right><nobr>';
		thtml += '                	<div id="navbuttonsright">';
		welcomebits();
		thtml += '                	</div>';
		thtml += '				</td></tr></table>';
		thtml += '        	</div>';
		thtml += '        </div>';
	}
		thtml += '        <div id="bd"><div class="bodycontent">';
} else {
		//search results page
		thtml += '<div id="doc3">';
		thtml += '        <div id="hdresults">';
		thtml += '			<div id="header_con_results">';
		thtml += '                <div id="logo_primary"><a href="'+baseurl+'/" target="_top" id="logo_link"></a></div>';
		thtml += '			</div>';
if(totestman == 'Lightbox:' || (typeof(cartview) != 'undefined' && cartview)){
		thtml += '			<div style="background: #666 url('+baseurl+'/graphics/bar-bg-white.gif) repeat-x;height:35px;margin-top: 0px;">';
} else {
		thtml += '			<div style="background: #666 url('+baseurl+'/graphics/bar-bg-white.gif) repeat-x;height:35px;margin-top: 0px;">';
//		thtml += '			<div style="background: #666 url('+baseurl+'/graphics/bar-bg-slightyellow.gif) repeat-x;height:35px;margin-top: 0px;">';
}
		thtml += '				<table width=100% height=20 width=100%><tr><td align=left><nobr>';
		thtml += writesearchbox();
		thtml += '					</td><td align=right><nobr>';
		thtml += '                	<div id="navbuttonsright">';
		welcomebits();
		thtml += '                	</div>';
		thtml += '				</td></tr></table>';
		thtml += '        	</div>';
		thtml += '        </div>';
if(totestman == 'Lightbox:' || (typeof(cartview) != 'undefined' && cartview)){
		thtml += '        <div id="bdresults"><div class="yui-g">';	
} else {
		thtml += '        <div id="bdresultsyellow"><div class="yui-g">';	

}
}


	
///////////////////// end of row 2////////////
thtml += '<div style="background-color:#fff;height:0px;background-color:#fff"><iframe id="RSIFrame" name="RSIFrame" style="width:0px; height:0px; border: 0px;background-color:#fff" src=nothing.html></iframe></div>';

document.write(thtml);

