//(c)gone2thedog.com 2004/2005/2006
var FRAMES="g2td_fRightg2td_fPage"
var MAINPAGE=["game","exposure"]//!game
var g_Rez=fnGetCookie("WinRez")
var g_Root=fnGetRootPath()

if(fnCheckFrames())
	d.writeln("<link rel=\"stylesheet\" href=\""+g_Root+g_Rez+"\/css\/column.css\" type=\"text\/css\">");

function fnCheckFrames(){
//Check Frames
	if(!fnFramesOK())
		return true
//check top window
	if(FRAMES.indexOf(window.name)<0||!window.name){
		window.top.location.replace(fnGetRootPath()+"index.html?"+self.location.pathname+self.location.hash)
		return false
	}
//Check g_Rez
	if(!g_Rez)
		if(window.top.scrW){
			window.top.fnSaveRez()
			g_Rez=window.top.rez
		}else		
			g_Rez=minW+"x"+minH
//check MAIN page	

	path=fnGetRelPath(true)
	var grep=eval("/("+MAINPAGE.join(")|(")+")/i")
	var mainPage=self.location.href.match(grep)
	var winMain=window.top.g2td_fMain
	if(!mainPage)
		mainPage="main.html"
	else
		mainPage=mainPage[0]+".html"
	if(winMain)
		if(winMain.location.href.indexOf(g_Rez)<0||winMain.location.pathname.indexOf(mainPage)<0){
			winMain.location.replace(g_Root+g_Rez+"/"+mainPage+"?"+path)
		}else if(self.parent.frames[0].btnfix){
			if(path.indexOf("/"))
				path=path.substr(path.lastIndexOf("/")+1)
				self.parent.frames[0].btnfix(path)
		}
	return true
}
function fnOpen(){
	window.open("music/player.html","music","width=300,height=110,scrollbars=0,menubar=0,statusbar=0")
}	
function fnDogPortal(){
	window.open("../dog/","sukaviewer","width=320,height=340,scrollbars=0,menubar=0,statusbar=0")
}
function fnPost(pDo){
	d.forms[0].dowhat.value=pDo
	if(fnChkEmail(d.forms[0].email))
		d.forms[0].submit()				
}	
function fnChkEmail(me){	
	var fld=me.value
	if(!fld)
		return false
	fld=fld.replace( /([‘’`])/g,"'").toLowerCase()
	fld=fld.replace(/( )+/g,"")
	fld=fld.replace(/(,)+/g,".")
	me.value=fld
	var f1 = /(@.*@)|(@\.)|(^@)|(\.@)|(@$)|(^\.)|(\.\.)|(\.$)/;
	var f2 = /^.+\@[a-z0-9\-\.]+\.([a-z]{2,4}|[0-9]{1,3})$/;
	if (!f1.test(fld) && f2.test(fld)){
		return true
	}	
	alert("                    Invalid Email Address\n\nYou have entered an incorrectly formatted email address.\n\nPlease check your email address");
	if(me.type!="hidden"){
		me.focus()
		me.select()
	}	
	return false;
}
