<!--
//-----------------------------------------------------------
//Color Translations
//green = #1D6C49
//blue = #3469BF
//yellow = #A3A62C
//red = #C40041
//orange = #FD6C0C
//-----------------------------------------------------------
//declare globally so i can use later
var color;
var bookmark;
//-----------------------------------------------------------
//function that runs on page load for all pages
 function onload()
{
	

	//hides pages from public -- during testing phase
	//if ((window.location.host == "gnawfish.com")||(window.location.host == "www.gnawfish.com"))
		//window.location = "http://gnawfish.com/errors/down.html";
	//else
	//{
	
			if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
				 if (document.cookie.indexOf("iphone_redirect=false") == -1) window.location = "/mobile/index.html";
			}
			
			//focus on google or whatever the first element is
			document.forms[0].elements[0].focus();	
	
			//if the user is not using the safari browser, do your thang
			if (navigator.userAgent.indexOf("Safari") == -1)
			{
				//create shortcut icon
				bookmark = document.createElement("link");
				bookmark.rel = "shortcut icon";
						
				//read cookie for color info
				color = readCookie("color");
		
				//if no cookie, drop cookie and set default
				if (!color)
				{
					//alert("No Cookie Detected, defaulting to blue")
					createCookie("color","#3469BF",365);
					color = "#3469BF";
				}
		
				//redfish
				if (color == "#C40041")
				{
					document.getElementById('style').href="http://www.gnawfish.com/styles/redfish.css";
					bookmark.href= "http://www.gnawfish.com/images/redfish.ico";
				}
					
				//greenfish
				else if(color == "#1D6C49")
				{
					document.getElementById('style').href="http://www.gnawfish.com/styles/greenfish.css";
					bookmark.href= "http://www.gnawfish.com/images/greenfish.ico";
				}
					
				//bluefish
				else if(color == "#3469BF")
				{
					document.getElementById('style').href="http://www.gnawfish.com/styles/bluefish.css";
					bookmark.href= "http://www.gnawfish.com/images/bluefish.ico";
				}
					
				//yellowfish
				else if(color == "#A3A62C")
				{
					document.getElementById('style').href="http://www.gnawfish.com/styles/yellowfish.css";
					bookmark.href= "http://www.gnawfish.com/images/yellowfish.ico";
				}
				
				//orangefish
				else if(color == "#FD6C0C")
				{
					document.getElementById('style').href="http://www.gnawfish.com/styles/orangefish.css";
					bookmark.href= "http://www.gnawfish.com/images/orangefish.ico";
				}
				
				//append the bookmark to the page for all browsers
				document.getElementsByTagName("head")[0].appendChild(bookmark);
			} //end if a user is not using safari
	//} //end if we are hiding the site
	
}

//-----------------------------------------------------------
//function that checks the correct radio button based on your current color
function gcolorload()
{		
	document.getElementById('jscript').style.visibility = "hidden";
	
	//if the user is not using the safari browser, do your thang
	if (navigator.userAgent.indexOf("Safari") == -1)
	{	
		//read cookie for color info
		color = readCookie("color");
	
		//Get the reference to the form
		var rads = document.forms['gcolor'];
		
	   	//redfish
		if (color=="#C40041")
			rads.thecolor[0].checked=true;
		
		//bluefish
		else if (color=="#3469BF")
			rads.thecolor[1].checked=true;
		
			
		//greenfish
		else if (color=="#1D6C49")
			rads.thecolor[2].checked=true;
			
		//yellowfish
		else if (color=="#A3A62C")
			rads.thecolor[3].checked=true;
			
		//orangefish
		else if (color=="#FD6C0C")
			rads.thecolor[4].checked=true;
		
		//if we are talking to opera, tell them they suck
		if (navigator.userAgent.indexOf("Opera") != -1)
			document.getElementById('opera').style.visibility = "visible";
		
	} //end if a user is not using safari
}
//-----------------------------------------------------------
//create generic new window link
function targetblank (url) {
	//The SPF link keeps changing. Lets catch what we have here so it gets redirected correctly
	var currentSpf = 'http://www.openspf.org/'
	if (url =='http://spf.pobox.com/certification.html'){
		url = currentSpf;
	}
	window.open(url,'_blank','menubar=yes,toolbar=yes,location=yes,directories=yes,fullscreen=no,titlebar=yes,hotkeys=yes,status=yes,scrollbars=yes,resizable=yes');
}

//opens a popup window with specific attributes
function MM_openBrWindow(theURL,winName,features) {
targetblank(theURL,winName,features);
}
//-----------------------------------------------------------
//create the wcag link
function xhtml(){
	targetblank('http://validator.w3.org/check?uri='+ window.location);
}

//-----------------------------------------------------------
//create the wcag link
function wcag(){
	targetblank('http://www.contentquality.com/mynewtester/cynthia.exe?rptmode=2&url1='+ escape(window.location));
	
}

//create the 508 link
function section508(){
	targetblank('http://www.contentquality.com/mynewtester/cynthia.exe?rptmode=-1&url1='+ escape(window.location));
}

//p3p link (just for blogger)
function p3p(){
	targetblank('http://validator.w3.org/p3p/20020128/p3p.pl?uri=http%3A//www.gnawfish.com');
}

//spf link (just for blogger)
function spf(){
	targetblank('http://spf.pobox.com/certification.html');
}

function rss(){
	targetblank('http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Fgnawfish.blogspot.com%2Ffeeds%2Fposts%2Fdefault');
}

//-----------------------------------------------------------
//create the css link
function css()
{
	//if the user is not using the safari browser, do your thang
	if (navigator.userAgent.indexOf("Safari") == -1)
	{	
		//redfish
		if (color=="#C40041")
			targetblank('http://jigsaw.w3.org/css-validator/validator?uri=http%3A//www.gnawfish.com/styles/redfish.css&amp;usermedium=all');
	
		//bluefish
		else if (color=="#3469BF")
			targetblank('http://jigsaw.w3.org/css-validator/validator?uri=http%3A//www.gnawfish.com/styles/bluefish.css&amp;usermedium=all');
			
		//greenfish
		else if (color=="#1D6C49")
			targetblank('http://jigsaw.w3.org/css-validator/validator?uri=http%3A//www.gnawfish.com/styles/greenfish.css&amp;usermedium=all');
			
		//yellowfish
		else if (color=="#A3A62C")
			targetblank('http://jigsaw.w3.org/css-validator/validator?uri=http%3A//www.gnawfish.com/styles/yellowfish.css&amp;usermedium=all');
		//orangefish
		else if (color=="#FD6C0C")
			targetblank('http://jigsaw.w3.org/css-validator/validator?uri=http%3A//www.gnawfish.com/styles/orangefish.css&amp;usermedium=all');
	
		else
			targetblank('http://jigsaw.w3.org/css-validator/validator?uri=http%3A//www.gnawfish.com/styles/css.css&amp;usermedium=all');	
	} //end if a user is not using safari
	else
		targetblank('http://jigsaw.w3.org/css-validator/validator?uri=http%3A//www.gnawfish.com/styles/css.css&amp;usermedium=all');
	

}

//-----------------------------------------------------------
//delete cookie, redirect user to gcolor page (to get around the fact that old/bad cookie may already be dropped)
function killcookie(){
	//erase cookie - if there is one
	eraseCookie("color");
	
	//redirect
	window.location.href ="gcolor.html";
}


//-----------------------------------------------------------
//set color fish
function setcolor(form)
{
		//erase cookie - if there is one
		eraseCookie("color");
				
		//red
		if (form.thecolor[0].checked)
		{
			color = "#C40041";
			createCookie("color","#C40041",365);
		}
		
		//blue
		else if (form.thecolor[1].checked)
		{
			color = "#3469BF";
			createCookie("color","#3469BF",365);
		}
		
		//green
		else if (form.thecolor[2].checked)
		{
			color = "#1D6C49";
			createCookie("color","#1D6C49",365);
		}
		
		//yellow
		else if (form.thecolor[3].checked)
		{
			color = "#A3A62C";
			createCookie("color","#A3A62C",365);
		}
		
		//orange
		else if (form.thecolor[4].checked)
		{
			color = "#FD6C0C";
			createCookie("color","#FD6C0C",365);
		}
			
}

//-----------------------------------------------------------
//store items
//greyt
function greyt()
{
	//if the user is not using the safari browser, do your thang
	if (navigator.userAgent.indexOf("Safari") == -1)
	{	
		//redfish
		if (color=="#C40041")
			targetblank('http://www.cafepress.com/gnawfish.16296937');
	
		//bluefish
		else if (color=="#3469BF")
			targetblank('http://www.cafepress.com/gnawfish.16288196');
			
		//greenfish
		else if (color=="#1D6C49")
			targetblank('http://www.cafepress.com/gnawfish.16297096');
			
		//yellowfish
		else if (color=="#A3A62C")
			targetblank('http://www.cafepress.com/gnawfish.16293621');
			
		//orangefish
		else if (color=="#FD6C0C")
			targetblank('http://www.cafepress.com/gnawfish.20724873');
	} //end if a user is not using safari
	else
		targetblank('http://www.cafepress.com/gnawfish.16297096');
	

}

//-----------------------------------------------------------
//cookie functionality
function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	var ck = name+"="+value+expires+"; path=/; domain=gnawfish.com;";
	document.cookie = ck;
}

//read the cookie
function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i<ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

//erases the cookie
function eraseCookie(name){
	createCookie(name,"",-1);
}
//-->