	if(typeof(baseurl) == 'undefined'){
        baseurl='http://www.win-initiative.com';
}
goinghome=0;

function ghome() {
	if(goinghome==1){
	} else {
		gsetCookie("gwhichstartpage","", "", "/", gGetCookieDom());
		var gurl = document.qform2.Keywords.value + '';
		var orient = '';
		var theurl= ''+ baseurl +'/SwishSearch?Keywords=' + gurl + orient ;
		self.location='' + theurl;
		goinghome=1;
	}
}



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

document.write('<table border="0" cellpadding="0" cellspacing="0">');
document.write('        <tr>  ');
document.write('            <td><form method="get" action="javascript: ghome();" enctype="application/x-www-form-urlencoded" name="qform2"></td>');
document.write('            <td width="164" valign="bottom" style="padding-bottom: 5px;"><input type="text" name="Keywords" class="textfield" id="Keywordfield" style="background: url('+ baseurl +'\'/images/keyword_background.gif\') -20px 0px no-repeat;width:164px; font-size:12px; padding-top: 3px;margin-top: 2px;color:#635f4d;"  onfocus="document.getElementById(\'Keywordfield\').style.background=\'none\';if(this.value==\'enter keywords\')this.value=\'\';" value=""  /></td>');
document.write('            <td width="40" valign="bottom" style="padding-bottom: 3px;" align=center><div style="padding-left: 3px; padding-bottom:4px;padding-right: 10px;"><nobr><a href="javascript:ghome();" class=nav style="color:#000; padding-left: 9px; font-weight: 800;">go</a></div></td>');
document.write('	    <td align=left valign=bottom style="padding-bottom: 3px;"><nobr><img src="'+ baseurl +'/images/win_comps8-1_08.gif" width="1" height="21" alt="" align="bottom"></td>');
document.write('	    <td align=right valign="bottom" style="padding-bottom: 3px;"><span id="navigatorhead"><span id="navigatorabout10" valign="bottom"><A href="'+ baseurl +'/user/search.shtml" class="nav"></a></span></span></td>');
document.write('            <td></form></td>');
document.write('        </tr>');
document.write('</table>');

}


gadmin_links = ggetCookie("display_admin_menu");
gadmin = ggetCookie("admin_level");
gsession = ggetCookie("gmpsess");

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

        /////// admin bar inline ///////
        if(gadmin && gsession && top == self)
        {
                document.write('<div id=navbar style="position:fixed; top:0px; background:#fff url(/graphics/admin_bg.gif) repeat-x top left; padding: 0px;width: 100%;margin: 0px;color: #ccc;padding-top: 5px; height: 20px;font-size: 9pt !important;"><font class=adminlabel>&nbsp;ADMIN:</font> <a href="/" target="left">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++){
                                document.write('<A href="' + tnavObjs[i]['lnk'] + '" class=>' + tnavObjs[i]['txt'] + '</a> | ');
                        }
                }
                document.write('</div><br/>');
        }
        //////




//top row
document.write('<table cellspacing="0" cellpadding="0" border="0" width="100%" style="background: #ffffff;margin-top: 6px;"><tr>');
document.write('        <td valign="bottom" align="left" height="43" width="165"" style="padding-left: 20px;"><A href="/"><img src="'+ baseurl +'/graphics/win-initiative_logo.gif" width="165" alt="Win-Initiative" style="margin-bottom: 23px;" border=0></a></td>');
document.write('	<td valign="bottom" align="left" height="43" width="235" style="padding-bottom: 20px;padding-left: 13px;"><font class=headertop><font style="color:#8c8c8c;">win-initiative</font> <font style="color:#000;">worldwide image navigation</font></td>');
//document.write('<img src="/graphics/win-initiative_slogan1.gif" width="281" height="16" alt="Win-Initiative" style="margin-bottom: 21px;margin-left: 18px">');
document.write('</td>');
//document.write('<td align=center valign=top></td>');

document.write('<td align=center valign=top>');
document.write('<div id="idrelease" style="display:block;"><a href="http://itunes.apple.com/us/app/id-release/id346858559?mt=8" target="idrelease"><img src="/graphics/iPhone-app-idrelease.gif" height=103 width=284 alt="ID Release"></a><div>');
document.write('</td>');


document.write('        <td align=right valign=bottom width=400 style="padding-right: 0px;padding-bottom: 20px;"><font class=headertop><font style="color:#8c8c8c;">authentic.</font> <font style="color:#000;">provocative.</font> <font style="color:#8c8c8c;">inspiring.</font></td>');
document.write('	<td width=69><A href="/"><img src="'+ baseurl +'/graphics/win-initiative-girl-logo.gif" width=69 height=100 style="margin-bottom: 6px;" border=0></a></td>');
//document.write('        <td align=right valign=bottom width=400 style="padding-right: 20px;"><img src="/graphics/win-initiative_slogan2.gif" width="215" height="16" alt="authentic.provacative.inspiring" style="margin-bottom: 21px;margin-right: 14px;"><A href="/"><img src="/graphics/win-initiative-girl-logo.gif" width=69 height=100 style="margin-bottom: 6px;" border=0></a></td>');
document.write('</tr></table>');

        if(gsession && gusername) {
			document.write('<table cellspacing="0" cellpadding="0" border="0" width="100%" height="15" style="background: #ffffff;"><tr>');
			document.write('<td valign=top align="right" style="padding-left:20px;">');
			document.write('<DIV style="padding-top: 0px;padding-right: 20px;margin-bottom: 1px;">');
			document.write('<B>welcome back ' + gusername);
			if (typeof(gcartimages) != 'undefined'){
				document.write('</B><img src="'+ baseurl +'/images/spacer.gif?n" width="1" height="21" alt="" align="absmiddle" style="padding-left: 10px;padding-right: 10px;"><A href="javascr' + 'ipt:topcartrefresh();" class=nav>images in cart &rarr; checkout</A>');
			}
			document.write('<img src="/images/spacer.gif?n" width="1" height="21" alt="" align="absmiddle" style="padding-left: 10px;padding-right: 10px;margin-bottom:2px;"></B><nobr><A HREF='+baseurl+'/bin/Profile class=nav>account</A>');
			document.write('<img src="/images/spacer.gif?n" width="1" height="21" alt="" align="absmiddle" style="padding-left: 10px;padding-right: 10px;margin-bottom:2px;"><A HREF='+baseurl+'/tools/DDload class=nav >downloads</A>');
			document.write('<img src="/images/spacer.gif?n" width="1" height="21" alt="" align="absmiddle" style="padding-left: 10px;padding-right: 10px;margin-bottom:2px;"><A HREF="javascript: gsetCookie2\(\'username\',\'\'\); gsetCookie2\(\'display_admin_menu\',\'\'\); gsetCookie2\(\'admin_level\',\'\'\);gsetCookie2\(\'gmpsess\',\'\'\);gsetCookie2\(\'gmpauth\',\'\'\);top.location=\'/index.shtml\';" class="nav">sign-out</A>');
			document.write('</div></td></tr></table>');
			document.write('<table cellspacing="0" cellpadding="0" border="0" width="100%" style="background: #ffffff;"><tr>');
			document.write('<td valign=bottom style="padding-left:20px;padding-bottom: 2px;">');
			writesearchbox();
			document.write('</td><td valign=bottom align="right" style="padding-right:20px;padding-bottom: 2px;">');
			document.write(' <span id="navigatorhead">');
			document.write('<table border="0" align="right"> <tr><td valign="top"><img src="/images/spacer.gif?n" width="1" height="21" alt=""></td><td valign="top"><span id="navigatorabout1" valign="top"><a href="'+baseurl+'/user/login.shtml" onclick="this.href+=\'?/SwishSearch?Keywords=\'+ukeys" class="nav"  onmouseover="ieNOOP();"></a></span></td>');
        } else {
			document.write('<table cellspacing="0" cellpadding="0" border="0" width="100%" style="background: #ffffff;"><tr>');
			document.write('<td valign=bottom style="padding-left:20px;padding-bottom: 2px;">');
			writesearchbox();
			document.write('</td><td valign=bottom align="right" style="padding-right:20px;padding-bottom: 2px;">');
			document.write(' <span id="navigatorhead">');
			document.write('<table border="0" align="right"> <tr><td valign="top"><img src="/images/spacer.gif?n" width="1" height="21" alt=""></td><td valign="top"><span id="navigatorabout1" valign="top"><a href="'+baseurl+'/user/login.shtml" onclick="this.href+=\'?/SwishSearch?Keywords=\'+ukeys" class="nav"  onmouseover="ieNOOP();"></a></span></td>');
        }

	document.write('<td valign="top"><img src="/images/win_comps8-1_08.gif" width="1" height="21" alt=""></td><td valign="top"><span id="navigatorabout2" valign="top"><a href="'+ baseurl +'/galleries_front.shtml" class="nav" onmouseover="gallerysub();"></a></span></td>');
	document.write('<td valign="top"><img src="/images/win_comps8-1_08.gif" width="1" height="21" alt=""></td><td valign="top"><span id="navigatorabout11" valign="top"><a href="http://www.wink-mag.com/" class="wink" onmouseover="clearsubnav();"></a></span></td>');
	document.write('<td valign="top"><img src="/images/win_comps8-1_08.gif" width="1" height="21" alt=""></td><td valign="top"><span id="navigatorabout12" valign="top"><a href="http://www.wink-blog.com/" class="wink" onmouseover="clearsubnav();"></a></span></td>');
	document.write('<td valign="top"><img src="/images/win_comps8-1_08.gif" width="1" height="21" alt=""></td><td valign="top"><span id="navigatorabout13" valign="top"><a href="http://www.tenbestten.com/" class="wink" onmouseover="clearsubnav();"></a></span></td>');
	document.write('<td valign="top"><img src="/images/win_comps8-1_08.gif" width="1" height="21" alt=""></td><td valign="top"><span id="navigatorabout14" valign="top"><a href="/win-shop.shtml" class="wink" onmouseover="clearsubnav();"></a></span></td>');

	document.write('<td valign="top"><img src="/images/win_comps8-1_08.gif" width="1" height="21" alt=""></td><td valign="top"><span id="navigatorabout3" valign="top"><a href="'+ baseurl +'/winspace_front.shtml" class="nav" onmouseover="clearsubnav();"></a></span></td>');
	document.write('<td valign="top"><img src="/images/win_comps8-1_08.gif" width="1" height="21" alt=""></td><td valign="top"><span id="navigatorabout4" valign="top"><a href="'+ baseurl +'/aboutus_mission.shtml"  class="nav" id="navabout" onmouseover="ieabout();"></a></span></td>');
	document.write('<td valign="top"><img src="/images/win_comps8-1_08.gif" width="1" height="21" alt=""></td><td valign="top"><span id="navigatorabout5" valign="top"><a href="'+ baseurl +'/bin/Profile"  class="nav" onmouseover="clearsubnav();"></a></span></td>');
	document.write('<td valign="top"><img src="/images/win_comps8-1_08.gif" width="1" height="21" alt=""></td><td valign="top"><span id="navigatorabout6" valign="top"><a href="'+ baseurl +'/SwishSearch?n=1&lb_view=1" class="nav"  onmouseover="ieStillCantDealWithAllThisNestedLooseHTML(); "></a></span></td>');
	document.write('<td valign="top"><img src="/images/win_comps8-1_08.gif" width="1" height="21" alt=""></td><td valign="top"><span id="navigatorabout7" valign="top"><a href="javascript:topcartrefresh();" class="nav" onmouseover="clearsubnav();"></a></span></td>');

	document.write('<td valign="top"><img src="/images/win_comps8-1_08.gif" width="1" height="21" alt=""></td><td valign="top"><span id="navigatorabout8" valign="top"><a href="'+ baseurl +'/help_starthere.shtml" class="nav" onmouseover="ieCantDealWithAllTheNestedHTML()"></a></span></td>');
	document.write('<td valign="top"><img src="/images/win_comps8-1_08.gif" width="1" height="21" alt=""></td><td valign="top"><span id="navigatorabout9" valign="top"><a href="'+ baseurl +'/contact.shtml" class="nav" onmouseover="clearsubnav();"></a></span></td></tr></table></span>');
	document.write('</nobr></font></td></tr>');
	document.write('	<tr>	<td colspan=2 style="padding-left: 20px;padding-right:20px;" align="right"><div style="border: 0px solid #fff;border-top: 1px solid #fff; width: 100%;">');
	document.write('<div align="right" id="navlayer" style="position:relative; width:1005px; height:14px; z-index:1;padding-top: 0px;"><font class="small">&nbsp;</font></div></div>');
	document.write('<iframe id="RSIFrame" name="RSIFrame" style="width:0px; height:0px; border: 0px" src=nothing.html></iframe>');

	function ieCantDealWithAllTheNestedLooseHTML () {
		MM_setTextOfLayer('navlayer','','<a href="'+baseurl+'/help_starthere.shtml" class="subnav" >start here</a> : <a href='+baseurl+'/help_login.shtml class=subnav>logging in</a> : <a href='+baseurl+'/help_search.shtml class=subnav >searching</a> : <a href='+baseurl+'/help_lightbox.shtml class=subnav >lightboxes</a> : <a href='+baseurl+'/help_purchase.shtml class=subnav >purchasing</a> : <a href='+baseurl+'/help_faq.shtml class=subnav >faq</a>');
	}

	function ieStillCantDealWithAllThisNestedLooseHTML () {
		MM_setTextOfLayer('navlayer','','<a href='+baseurl+'/SwishSearch?n=1&lb_view=1 class=subnav >view your lightbox</a> : <a href=javascript:topcartrefresh(); class=subnav >view shopping cart</a> : <a href='+baseurl+'/tools/DDload class=subnav >download area</a><img src='+baseurl+'/graphics/spacer.gif width=4 height=1>');
	}

	function ieNOOP () {
		MM_setTextOfLayer('navlayer','','<a href="'+baseurl+'/user/login.shtml" class=subnav>sign-in</a> : <a href='+baseurl+'/bin/Register class=subnav >client register</a> : <a href='+baseurl+'/talent_join_signin.shtml class=subnav>talent join</a> : <a href='+baseurl+'/bin/Register?supst=talent class=subnav >talent register</a> : <a href="/user/login_dripbook.shtml" class=subnav >dripbook</a><img src='+baseurl+'/graphics/spacer.gif width=733 height=1>');
	}

	function ieabout (){
		MM_setTextOfLayer('navlayer','','<a href='+baseurl+'/aboutus_mission.shtml class=subnav>about</a> : <a href='+baseurl+'/sponsors.shtml class=subnav>sponsors</a> : <a href='+baseurl+'/partners.shtml class=subnav>partners</a> : <a href='+baseurl+'/workshops.shtml class=subnav>workshops</a> : <a href='+baseurl+'/talent_join_signin.shtml class=subnav>talent join</a> : <a href='+baseurl+'/non-profit_support.shtml class=subnav>non-profit support</a><img src='+baseurl+'/graphics/spacer.gif width=88 height=1>');
	}


	function gallerysub (){
		MM_setTextOfLayer('navlayer','','<a href='+baseurl+'/galleries_front.shtml class=subnav>recent galleries</a> : <a href='+baseurl+'/galleries_index.shtml class=subnav>gallery index</a><img src='+baseurl+'/graphics/spacer.gif width=756 height=1>');
	}
	if(gsession){
		document.write('<iframe id="LBFrame" name="LBFrame" style="width:0px; height:0px; border: 0px" src="nothing.html"></iframe>');
	}
document.write('</TD></TR></TABLE>');

if(typeof(searchpage) == 'undefined'){
	document.write('<DIV id="mainwrapper"><div>');
}



function dlauth(iid,sssh,t1,t2,p,db){
        //check for cookie
        gdlct = ggetCookie("gdlct");


        //if no cookie create one
        if(!gdlct){
                var d = new Date();
                 d.setMinutes(d.getMinutes()+ 24*60*30);//one month expiration date
                gdlct=iid + ',';
                 gsetCookie('gdlct', gdlct, d, '/', gGetCookieDom());

        } else {
                var inthere=0;
                var tara=gdlct.split(',');
                //check for id in cookie list
                for(i=0;i<=tara.length;i++){
                        if(tara[i]== iid){
                                inthere=1;
                        }
                }
        //if not there, add it in
                if(inthere==0){
                        gdlct+=iid + ',';
                }
                 gsetCookie('gdlct', gdlct, d, '/', gGetCookieDom());
        }


        if(gdlct.length > 11 * 2 && !p){ // too many downloads this time period
                //if there, alert the user and deny it
                alert('We have limited the downloads to one per talent per week. If your shoot needs are more than this contact us.');
        } else {
		//var tlurl = '/brief_view.shtml?' + t1 + '|' + t2;
		if(db){
			tlurl='/pdf_briefs_dripbook/WIN-Brief_' + iid + '.pdf';
		} else {
			tlurl='/pdf_briefs/WIN-Brief_' + iid + '.pdf';
		}
		displayWindow2(tlurl,1000,800);
		
        }
}


