
/*style selection by browser detection___________________________________*/

var browser;

if (document.getElementById)
	{ document.write('<link rel="stylesheet" type="text/css" href="standard.css" media="screen">'); }
else 
	{ document.write('<link rel="stylesheet" type="text/css" href="old.css" media="screen">'); }
	
if (document.getElementById && navigator.userAgent.indexOf('Safari')!==-1) 
	{ document.write('<link rel="stylesheet" type="text/css" href="safari.css" media="screen">'); }

if (document.getElementById && navigator.userAgent.indexOf('Opera')!==-1) 
	{ document.write('<link rel="stylesheet" type="text/css" href="opera.css" media="screen">'); }
	
if (document.getElementById && navigator.userAgent.indexOf('MSIE 5')!==-1 && navigator.userAgent.indexOf('Windows')!==-1) 
	{ document.write('<link rel="stylesheet" type="text/css" href="iepc5.css" media="screen">'); }

if (document.getElementById && navigator.userAgent.indexOf('MSIE 6')!==-1 && navigator.userAgent.indexOf('Windows')!==-1) 
	{ document.write('<link rel="stylesheet" type="text/css" href="iepc6.css" media="screen">'); }
	
if (document.getElementById && navigator.userAgent.indexOf('MSIE')!==-1 && navigator.userAgent.indexOf('Mac')!==-1) 
	{ document.write('<link rel="stylesheet" type="text/css" href="iemac.css" media="screen">'); }


/* toggle subnav (not in use)_____________________________________________*/

function subnavIn(whichElement)
	{ document.getElementById(whichElement).style.display="block" }

function subnavOut(whichElement)
	{ document.getElementById(whichElement).style.display="none" }
		
/* open new windows with browser detection_______________________________ */
 /*Even with re-sizing of popup, setting size here avoids expanding beyond screen. 600px width is set for fixed-size popup's margins.*/
 
leftPos1=0
if (screen)
	{ leftPos1=screen.width-605; } 

leftPos2=0 
if (screen) 
	{ leftPos2=screen.width-625; }

function newWindow1(source)
{ 
	if (document.getElementById) 
		{ 
			window1=window.open(source, "win1", "width=630/*was 600 when resizeable*/,height=635/*was 660 when resizeable*/,left=0,top=0,menubar=no,toolbar=no,scrollbars=yes,resizable=yes"); 
			window1.focus(); 
		} 
	else
		{ 
			window1=window.open(source, "win1", "width=630/*was 580 when resizeable*/,height=635/*was 660 when resizeable*/,left=0,top=0,menubar=no,toolbar=no,scrollbars=yes,resizable=yes"); 
			window1.focus(); 
		} 	
}

/*back to opener page________________________________________________________________*/

function goBack() 
{ 
	if (opener) 
		{			
			window.close();
			opener.focus();
			return false;
		}
	else 
		{ 
			return true; 
		}
}

/*confirm and redirect messages________________________________*/

function portfolio_confirm()
 	{ 
 		if (confirm("You have successfully created your portfolio. Click 'OK' to view all portfolios, or 'Cancel' to create another one."))
 			{ window.location='admin_portfolios.php'; }
 	}
 	
function portfolio_edit_confirm()
 	{ 
 		if (confirm("You have successfully updated your portfolio details. Click 'OK' to view all portfolios, or 'Cancel' to make further changes."))
 			{ window.location='admin_portfolios.php'; }
 	}
 	
function image_confirm(portfolio)
 	{ 
 		if (confirm("You have successfully uploaded your image. Click 'OK' to view all images in the same portfolio, or 'Cancel' to upload another one."))
 			{ window.location='admin_thumbs.php?portfolionumber='+portfolio; }
 	}
 	
function image_edit_confirm(portfolio)
 	{ 	
 		if (confirm("You have successfully updated your image details. Click 'OK' to view all images in the same portfolio, or 'Cancel' to make further changes. \nPlease note that if you have moved your image to another portfolio, you may need to revise its captions."))
 			{ window.location='admin_thumbs.php?portfolionumber='+portfolio; }
 	}
 	
/*focus first non-hidden form element__________________________________*/
	
function form_focus()
	{
		if (document.forms)
			{    
				elements=document.forms[0].elements; 
				for (i=0; i<elements.length; i++)
					{
						element=elements[i];
						if (element.type && element.type=="hidden") { continue; }
						element.focus();
						break;
					}						
			}
	}
	
/*focus form element (not in use)_______________________________________*/

/*function formFocus()
{ 
	if (document.forms.length>0 && document.forms[0].elements.length>0)
		document.forms[0].elements[0].focus();
}
window.onload=formFocus; */
	
/*select first non-empty form value__________________________________*/
	
function form_select()
	{
		if (document.forms)
			{    
				elements=document.forms[0].elements; 
				for (i=0; i<elements.length; i++)
					{
						element=elements[i];
						if ((element.type && element.type=="hidden") || element.value=='') { continue; }
						element.select();
						break;
					}						
			}
	}
	
/*select incorrectly filled-in form value (if single un-named form on page)___*/
	
function form_error_select(which)
	{
		if (document.forms)
			{    
				elements=document.forms[0].elements; 
				element=elements[which];
				element.select();	
			}
	}
	
/*for email link and rollover________________________________________________*/

function f_riguduw(u)
	{
		rigu='.com';
		pre='mail';
		udu='@';
		url=pre+'to:'+u;
		uwu='ericfield';		
		document.location.href=url+udu+uwu+rigu;
	}
function f_riguduw2(u)
	{
		rigu='.com';
		uwu='ericfield';
		udu='@';				
		document.write('\<input type=\"hidden\" class=\"hidden\" name=\"recipient\" value=\"'+u+udu+uwu+rigu+'\"\ />');
	}

if (document.images)
	{
		e_image=new Image;
		e_image_hover=new Image;
		e_image.src="images/eric.gif";
		e_image_hover.src="images/eric_hover.gif";
	}
else
	{
		e_image="";
		e_image_hover="";
		document.send="";
	}
	
	
/* nav rollover backgrounds (pf2 necessary for nav2 div_________________________________*/

function pfOn(whichId)
	{ document.getElementById(whichId).style.color=/*"#f3faff";*/"#949faf"; }

function pfOff(whichId)
	{ document.getElementById(whichId).style.color=/*"#c3cacf";*/"#606d7d"; }
	
function pf2On(whichId)
	{ document.getElementById(whichId).style.color=/*"#f3faff";*/"#949faf"; }

function pf2Off(whichId)
	{ document.getElementById(whichId).style.color=/*"#c3cacf";*/"#949faf"; }

	
	
	
	
