var isWin;
var winW;
var winH;
var contW;


var theCan;
var postTotal;
var dontDo=false;

var cowBlendVal=0;
var bunBlendVal;
var whatgives=0;

var theUser;
var theID;
var whichPost;
var makeComm=0;
var whichPg;
var where="new";
var whichBov='1';
var bovCk;
var isActive=0;
var forecast;

var contFlag;

var viewH=null;
var proH=null;
var bovH=null;

var homeCow=false;

function getWindow()
{
	
	if( typeof( parent.window.innerWidth ) == 'number' )
	{
			//Non-IE
		winW = top.window.innerWidth;
		winH = top.window.innerHeight;
		isWin=false;
	}
	else if( parent.document.documentElement && ( parent.document.documentElement.clientWidth || parent.document.documentElement.clientHeight ) )
	{
			//IE 6+ in 'standards compliant mode'
		winW =top.document.documentElement.clientWidth;
		winH = top.document.documentElement.clientHeight;
	
		isWin=true;
	}
	else if( parent.document.body && ( parent.document.body.clientWidth || parent.document.body.clientHeight ) )
	{
			//IE 4 compatible
		winW = top.document.body.clientWidth;
		winH = top.document.body.clientHeight;
		isWin=true;
	}
	return [winW, winH, isWin];
}

function setAll(flag)
{
	//var thisW=document.getElementById('body').offsetWidth;
	
	//if (isWin==false)
	//{
		//document.getElementById('logo').style['width']=winW-15+'px';
	//}
	//else
	//{
		//document.getElementById('logo').style['width']=winW+'px';
	//}

	var i;
	
	var theBod=document.getElementById('body');
	var theCont=document.getElementById('container');
	//theCont.style.height=winH-175+'px';
	
	//theCont.style.left=Math.round((winW-600)/2);
	
	if (flag==0)
	{
		for (i=0; i<=100; i++)
		{
			var aDiv=document.createElement('div');
			aDiv.className='blendy';
			aDiv.style['top']=(150+i)+'px';
			aDiv.style['opacity']=1-(i*(.005+(i*.00005)));
		
			aDiv.style['filter']="alpha(opacity="+(100-(i*(.5+(i*.005))))+")"

			theBod.appendChild(aDiv);
		
			//if (navigator.appName.indexOf("Microsoft")!=-1)
			//{
			//	aDiv.style['width']=winW+'px';
			//}
		}
	}
	//document.getElementById('bottom').style.top=document.getElementById('container').offsetHeight+165;
	top.document.getElementById('control').style.left=winW-230;
	
	//document.getElementById('ads').style.float='left';
	
	//contW=winW-320;
	
	//theCont.style.width=contW;
	//alert(winW);
	
	top.main.document.getElementById('container').style.visibility='visible';
	try
	{
		top.main.container.document.getElementById('body').style.visibility='visible';
	}
	catch(err)
	{}
	//document.getElementById('bovine').src="/_mmeBovina.html";
}

function newWidth()
{
	if( typeof( window.innerWidth ) == 'number' )
	{
			//Non-IE
		winW = top.window.innerWidth;
		winH = top.window.innerHeight;
		isWin=false;
	}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
	{
		//IE 6+ in 'standards compliant mode'
		winW = top.document.documentElement.clientWidth;
		winH = top.document.documentElement.clientHeight;
	
		isWin=true;
	}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
	{
		//IE 4 compatible
		winW = top.document.body.clientWidth;
		winH = top.document.body.clientHeight;
		isWin=true;
	}
}

function setFrame(holder, flag, bovArch)
{
	var theHead;
	var thePost;
	var startHead=document.getElementById('h_0');
	var startPost=document.getElementById('p_0');
	if (holder != 'bov_container')
	{
		var commBut=document.getElementById('cBut_0');
		var commHead=document.getElementById('commH_0');
		var comm=document.getElementById('comm_0');
	}
	
	document.getElementById('archLink').style.width=winW-304;
	
	
	
	var headHt;
	var commHt;
	
	if (flag == 0)
	{
		startHead.style.position='absolute';
		startHead.style.left='0px';
		startPost.style.top='20px';
	}
	
	if (commHead)
	{
		headHt=commHead.offsetHeight+10;
		commHt=comm.offsetHeight+10;
	}
	else
	{
		headHt=0;
		commHt=0;
	}
	
	//alert('here');
	startPost.style.height=startPost.offsetHeight+20+'px';
	
	if (holder != 'bov_container')
	{
		var startH=startPost.offsetHeight+startHead.offsetHeight+headHt+commHt;
	}
	else
	{
		var startH=startPost.offsetHeight+startHead.offsetHeight+headHt;
	}
	var i;
	for (i=1; i<=postTotal-1; i++)
	{
		theHead=document.getElementById('h_'+i);
		thePost=document.getElementById('p_'+i);
		
		theHead.style.width=winW-304;
		
		if (holder != 'bov_container')
		{
			commBut=document.getElementById('cBut_'+i);
	
			commHead=document.getElementById('commH_'+i);
			comm=document.getElementById('comm_'+i);
		}
		if (isWin == true)
		{
			theHead.style.left="-10px";
			if (where=='new')
			{
				//document.getElementById('archLink').style.left="-10px";
			}
		}
		
		if (commHead)
		{
			headHt=commHead.offsetHeight;
			commHt=comm.offsetHeight;
		}
		else
		{
			headHt=0;
			commHt=0;
		}

		//alert(1);
		//theHead.style['top']=startH+'px';
		//alert(2);
		//alert(headHt);
		if (holder != 'bov_container')
		{
			startH=startH+thePost.offsetHeight+theHead.offsetHeight+headHt+commHt;	
		}
		else
		{
			startH=startH+thePost.offsetHeight+theHead.offsetHeight+headHt;	
		}
		//alert(startH);
	}
	
	if (bovArch == 0)
	{
		parent.document.getElementById(holder).style.height=startH+'px';
	}
	else
	{
		parent.document.getElementById(holder).style.height=startH+100+'px';
		top.main.document.getElementById('bovine').style.height=startH+700+'px';
		top.window.document.body.scrollTop='0px';
	}
}

function rollover(but)
{
	but.style.background='#9b394a';
	but.style.color='white';
	document.body.style.cursor='pointer'
}

function rollOut(but)
{
	but.style.background='#cd9ca4';
	
	but.style.color='#9b394a';
	document.body.style.cursor='Default';
}

function mDown(but)
{
	but.style.background='white';
	but.style.color='#9b394a';
}

function mUp(but)
{
	but.style.background='#9b394a';
	but.style.color='white';
}

function makeRay()
{
	var opCnt=0;
	var rayHolder=document.getElementById('ray');
	var q=0;
	for (i=0; i<=100; i++)
	{
		var aBeam=document.createElement('div');
		aBeam.className='beam';
		aBeam.style['left']=130-i;
		
		if (i%2==0)
		{
			aBeam.style['top']=q*2+2;
			q=q+2;
		}
		else
		{
			aBeam.style['top']=q*2;
		}
		
		//if ((i>=57) && (i<=60) && (isWin==true))
		//{
		//	aBeam.style['height']='8px';
		//}

		if (i>=60)
		{
			if (i%2==0)
			{
				aBeam.style['opacity']=1-(.05*opCnt);
				aBeam.style['filter']="alpha(opacity="+(100-(5*opCnt))+")";
				opCnt+=1;
			}
			//aBeam.className=opArray[opCnt]+' beam';
			aBeam.style['opacity']=1-(.05*opCnt);
			aBeam.style['filter']="alpha(opacity="+(100-(5*opCnt))+")";
		}
		//aBeam.style['height']='20px';
		
		aBeam.style['width']=20+(i*2);
		rayHolder.appendChild(aBeam);
		q+=1;
	}
}


function moveMenu1()
{
	theTop=document.body.scrollTop;	

	top.main.document.getElementById('menu').style['top']=theTop+'px';
}


function orbRoll(item)
{
	item.src='/images/orb_ov.gif';
	document.body.style.cursor='pointer';
}

function orbOut(item)
{
	item.src='/images/orb.gif';
	document.body.style.cursor='default';
}



//MENU control


		function proMen()
		{
			var topMen=parent.document.getElementById('men1C');
			var men2=parent.document.getElementById('men2C');
			var men3=parent.document.getElementById('men3C');
			var men4=parent.document.getElementById('men4C');

			topMen.style['top']='-57px';
			topMen.innerHTML='<b>News<br>& Views</b>';
			parent.document.getElementById('menu1').onclick=nandv;
			
			men2.innerHTML="<b>Ask<br>Madame Bovina</b>"
			men2.style['top']='-57px';
			cowBlendVal=0;
			parent.document.getElementById('menu2').onclick=loadBovine;

			men3.innerHTML="<b>Merchandise</b>";
			men3.style['top']='-40px';
			parent.document.getElementById('menu3').onclick=merch;
			
			men4.innerHTML="<b>Favorite Links</b>";
			men4.style['top']='-40px';
			parent.document.getElementById('menu4').onclick=links;
			
		}
		
		function merch()
		{
			window.open('http://loveranch.awardspace.com/ab.html', '_blank');
		}
		
		function nandvMen()
		{
			var topMen=parent.document.getElementById('men1C');
			var men2=parent.document.getElementById('men2C');
			var men3=parent.document.getElementById('men3C');
			var men4=parent.document.getElementById('men4C');

			var topMen=parent.document.getElementById('men1C');
			topMen.style['top']='-47px';
			topMen.innerHTML='<b>Professional<BR>Services</b>';
			
			men2.innerHTML="<b>Ask<br>Madame Bovina</b>"
			men2.style['top']='-57px';
			cowBlendVal=0;
			parent.document.getElementById('menu2').onclick=loadBovine;
			
			men3.innerHTML="<b>Merchandise</b>";
			men3.style['top']='-40px';
			parent.document.getElementById('menu3').onclick=merch;
		
			men4.innerHTML="<b>Favorite Links</b>";
			men4.style['top']='-40px';
			parent.document.getElementById('menu4').onclick=links;

			parent.document.getElementById('menu1').onclick=proServ;
		}
		
		
		function linksMen()
		{
			var topMen=parent.document.getElementById('men1C');
			var men2=parent.document.getElementById('men2C');
			var men3=parent.document.getElementById('men3C');
			var men4=parent.document.getElementById('men4C');
			
			topMen.style['top']='-57px';
			topMen.innerHTML='<b>News<BR>& Views</b>';
			parent.document.getElementById('menu1').onclick=nandv;

			men2.innerHTML='<b>Professional<br>Services</b>';
			men2.style['top']='-47px';
			cowBlendVal=0;
			parent.document.getElementById('menu2').onclick=proServ;

			men3.innerHTML='<b>Ask<BR>Madame Bovina</b>';
			men3.style['top']='-57px';
			parent.document.getElementById('menu3').onclick=loadBovine;
			
			men4.innerHTML='<b>Merchandise</b>';
			men4.style['top']='-40px';
			parent.document.getElementById('menu4').onclick=merch;
			//parent.document.getElementById('menu3').onclick='';
			//parent.document.getElementById('menu4').onclick='';
		}
		
		
		function testMe()
		{
			alert('this is it');
		}
		
		function nandv()
		{
			top.main.document.getElementById('container').style.visibility="hidden";
			//document.getElementById('container').className="invis";
			parent.window.orbOut(parent.document.getElementById('orb2'));
////			//parent.setCookie(parent.theID, 'new', parent.whichBov);
			parent.document.forms.nandv.submit();
			
		}
		
		function proServ()
		{
			top.main.document.getElementById('container').style.visibility="hidden";
			//top.main.document.getElementById('container').className="invis";
			parent.window.orbOut(parent.document.getElementById('orb2'));
////			parent.setCookie(parent.theID, 'professional', parent.whichBov);
			parent.document.forms.pro.submit();
		}		
		
		function links()
		{
			top.main.document.getElementById('container').style.visibility="hidden";
			//document.getElementById('container').className="invis";
			parent.window.orbOut(parent.document.getElementById('orb2'));
////			parent.setCookie(parent.theID, 'links', parent.whichBov);
			parent.document.forms.links.submit();
		}
				
		function loadBovine(flag)
		{
////			top.main.setCookie(parent.theID, parent.where, '2');
			//top.main.window.haveCow=true;
			//top.document.getElementById('main').style.height='0px';
			top.homeCow=false;
			top.mmeResize=true;
			
			var cowFrame=top.document.getElementById('bovine');
			
			if ((flag != 1) && (flag != 2))
			{
				cowFrame.style.opacity="0";
				cowFrame.style['filter']='alpha(opacity=0)';
				cowBlendVal=0;
			}
			else if (flag == 1)
			{
				cowFrame.style.opacity="1";
				cowFrame.style['filter']='alpha(opacity=100)';
			}
			else if (flag == 2)
			{
				cowFrame.style.opacity="1";
				cowFrame.style['filter']='alpha(opacity=100)';
				
			}

			cowFrame.style.width="102%";


			//cowFrame.style.height=top.bovine.document.getElementById('bov_container').offsetHeight+top.bovine.document.getElementById('bov_container').offsetTop+50;


			cowFrame.style.height=top.bovine.document.getElementById('bov_container').offsetHeight+600;
			
			if (top.main.document.getElementById('container').offsetHeight+150 > cowFrame.offsetHeight)
			{
				cowFrame.style['height']=top.main.document.getElementById('container').offsetHeight+300;
				
			}

			if ((flag != 1) && (flag != 2))
			{
				setTimeout("blend_a_cow()", 0);
			}
			top.bovine.bov_container.lastDitch();
		}
		
		
		
		function cowFromHome()
		{
			
////			top.main.setCookie(parent.theID, parent.where, '2');

			var cowFrame=top.main.document.getElementById('bovine');
			cowFrame.style.visibility='hidden';
			cowFrame.style.opacity="1";
				cowFrame.style['filter']='alpha(opacity=100)';
			
			if (isWin==false)
			{
				cowFrame.style['width']=winW-15;
			}
			else
			{
				cowFrame.style['width']=winW;
			}
			cowFrame.style.visibility='visible';
			cowFrame.style.zIndex='6';
			alert('there');
		}
		
		
		
		function blend_a_cow()
		{
			//alert(cowBlendVal);
			whatgives+=1;
			var theBovine=top.document.getElementById('bovine');
			theBovine.style['opacity']=cowBlendVal;
			theBovine.style['filter']='alpha(opacity='+(cowBlendVal*100)+')';
			if (cowBlendVal<1)
			{
				//alert(whatgives);
				//setInterval("blend_a_cow()",100);
				cowBlendVal+=.1;
				setTimeout("blend_a_cow()", 0);
			}
			
			//parent.control.document.getElementById('control').style.color='white';
			//parent.control.document.getElementById('link').style.color='white';
			//if (parent.control.document.getElementById('man') != null)
			//{
			//	parent.control.document.getElementById('man').style.color='white';
			//}
			//else
			//{
				//alert(1);
			//	loadBovine();
			//}
		}
		
		function blend_a_bun()
		{
			var theBovine=parent.document.getElementById('bovine');
			theBovine.style['opacity']=bunBlendVal;
			theBovine.style['filter']='alpha(opacity='+(bunBlendVal*100)+')';
			if (bunBlendVal>0)
			{
				bunBlendVal=bunBlendVal-.1;
				setTimeout("blend_a_bun()",0);
			}
			else
			{
				var cowFrame=top.document.getElementById('bovine');
				//cowFrame.style.className='collapse';
				cowFrame.style.width="0px";
				cowFrame.style.height="0px";
				
				cowFrame.style.opacity="1.0";
				cowFrame.style.filter='alpha(opacity=100)';
				//cowFrame.style.width='0px';
			}
			//parent.control.document.getElementById('control').style.color='#9b394a';
			//parent.control.document.getElementById('link').style.color='#9b394a';
		}
		
		
		//MME Bovina funtions
		
		
		
		function setStuff(flag)
		{
			//alert(document.title);
			
			var bovHt=top.document.getElementById('body').offsetHeight;
			
			if (flag != 1)
			{
				top.document.getElementById('bovine').style.height=bovHt;
			}
			
			if (isWin==true)
			{
				document.getElementById('inst').style.height='359px';
			}
		}
		
		function astroBack(flag)
		{
			top.mmeResize=false;
			
			top.document.getElementById('main').style.width='102%';
			var bodyH=top.main.document.getElementById('container').offsetHeight;
			bodyH=bodyH+200;
			top.document.getElementById('main').style.height=bodyH;
			if (flag == 1)
			{
				//top.main.location="/black.html";
				//top.main.location='/01_index.html';
				var aTest=top.document.getElementsByTagName('frameset');
				var theOne=aTest[0]; theOne.rows='100%,0%';
			}
			else
			{
				//cowFrame.style.height='0px';
				setTimeout("blend_a_bun()",0);
			}
		}
		
		function visAll()
		{
			theBod=document.getElementById('body');
			
			var theEl=0;
			var doit=true;
			
			//while (doit==true)
			//{
				alert(theBod.child[0]);
			//}
			
			
		}

//login, etc. window controllers

function showUtility(flag, user, test)
{
	//alert(flag);
	if (flag == undefined)
	{
		flag='log';
	}
	var theGray=top.document.getElementById('gray');
	//theGray.style.top=winH+top.document.body.scrollTop;
	if (isWin==false)
	{
		theGray.style.width=winW;
	}
	else
	{
		theGray.style.width=winW+15;
	}

	//top.main.document.getElementById('container').style.left="-7px";
	
	theGray.style.height=winH+20;
	theGray.style.top=top.document.body.scrollTop
	theGray.className='vis';
	
	top.document.getElementById('body').style.overflow="hidden";
	
	if (top.bovine.offsetWidth > 0)
	{
		top.bovine.style.width=winW;
	}
	if (isWin == false)
	{
		//top.main.document.getElementById('logo').style.width=winW;
	}
	var theWin=top.document.getElementById('utility');
	var theFrame=top.document.getElementById('utilCont');
	
	if (flag=='log')
	{
		theWin.style.height='170px';
		theWin.style.width='300px';
		theWin.style.top=Math.round((winH-170)/2)+top.document.body.scrollTop;
		theWin.style.left=Math.round((winW-300)/2);
		
		top.document.getElementById('utilCont').src="/windows/login.html";
		theFrame.style.height='160px';
		theFrame.style.width='280px';
	}
	else if (flag=="forecast")
	{
		theWin.style.height='500px';
		theWin.style.width='400px';
		theWin.style.top=Math.round((winH-500)/2)+top.document.body.scrollTop;
		theWin.style.left=Math.round((winW-400)/2);
		
		top.document.getElementById('utilCont').src="/windows/forecast.html";
		
		forecast=test;
		//top.main.document.getElementById('utilCont').document.getElementById('body').innerHTML=test;
		
		theFrame.style.height='470px';
		theFrame.style.width='380px';
	
	}
	else if (flag == 'comm')
	{
		theWin.style.height='250px';
		theWin.style.width='500px';
		theWin.style.top=Math.round((winH-250)/2)+top.document.body.scrollTop;
		theWin.style.left=Math.round((winW-500)/2);
		
		if (isWin==true)
		{
			theFrame.style.height='270px';
		}
		else
		{
			theFrame.style.height='230px';
		}
		theFrame.style.width='480px';

		top.document.getElementById('utilCont').src="/windows/comment.html";
	}
	else if (flag == 'bov')
	{
		theWin.style.height='300px';
		theWin.style.width='500px';
		theWin.style.top=Math.round((winH-300)/2)+main.document.body.scrollTop;
		theWin.style.left=Math.round((winW-500)/2);
		
		theFrame.style.height='280px';
		theFrame.style.width='480px';

		top.document.getElementById('utilCont').src="/windows/bovine.html";
	}
	else if (flag == 0)
	{
		theWin.style.height='170px';
		theWin.style.width='300px';
		theWin.style.top=Math.round((winH-170)/2)+top.document.body.scrollTop;
		theWin.style.left=Math.round((winW-300)/2);
		
		top.document.getElementById('utilCont').src="/windows/manLogin.html";
		theFrame.style.height='160px';
		theFrame.style.width='280px';
	}
	else if (flag == 'man')
	{
		theWin.style.height='330px';
		theWin.style.width='500px';
		theWin.style.top=Math.round((winH-330)/2)+top.document.body.scrollTop;
		theWin.style.left=Math.round((winW-500)/2);
		
		theFrame.style.height='310px';
		theFrame.style.width='480px';

		top.document.getElementById('utilCont').src="/windows/astroManage.html";
	}
	else if (flag == 'sign')
	{
		theWin.style.height='415px';
		theWin.style.width='500px';
		theWin.style.top=Math.round((winH-415)/2)+top.document.body.scrollTop;
		theWin.style.left=Math.round((winW-500)/2);
		
		theFrame.style.height='395px';
		theFrame.style.width='480px';

		top.document.getElementById('utilCont').src="/windows/astroSignup.html";
	}
	else if (flag == 'notActive')
	{
		theWin.style.height='170px';
		theWin.style.width='300px';
		theWin.style.top=Math.round((winH-170)/2)+top.document.body.scrollTop;
		theWin.style.left=Math.round((winW-300)/2);
		
		if (test != 'bov')
		{
			top.document.getElementById('utilCont').src="/windows/noActive.html";
		}
		else
		{
			top.document.getElementById('utilCont').src="/windows/noBovActive.html";
		}
		theFrame.style.height='160px';
		theFrame.style.width='280px';
	}
	else if (flag == 'pass')
	{
		theWin.style.height='220px';
		theWin.style.width='350px';
		theWin.style.top=Math.round((winH-220)/2)+top.document.body.scrollTop;
		theWin.style.left=Math.round((winW-350)/2);
		
		theFrame.style.height='200px';
		theFrame.style.width='330px';

		top.document.getElementById('utilCont').src="/windows/forgotPass.html";
	}
	else if (flag == 'user')
	{
		theWin.style.height='200px';
		theWin.style.width='350px';
		theWin.style.top=Math.round((winH-200)/2)+top.document.body.scrollTop;
		theWin.style.left=Math.round((winW-350)/2);
		
		theFrame.style.height='180px';
		theFrame.style.width='330px';

		top.document.getElementById('utilCont').src="/windows/forgotUser.html";
	}
	else if (flag == 'both')
	{
		theWin.style.height='220px';
		theWin.style.width='350px';
		theWin.style.top=Math.round((winH-220)/2)+top.document.body.scrollTop;
		theWin.style.left=Math.round((winW-350)/2);
		
		theFrame.style.height='200px';
		theFrame.style.width='330px';

		top.document.getElementById('utilCont').src="/windows/forgotBoth.html";
	}
	else if (flag == 'contact')
	{
		theWin.style.height='290px';
		theWin.style.width='500px';
		theWin.style.top=Math.round((winH-290)/2)+top.document.body.scrollTop;
		theWin.style.left=Math.round((winW-500)/2);
		
		theFrame.style.height='270px';
		theFrame.style.width='480px';
		top.document.getElementById('utilCont').src="/windows/contact.html";
		//top.utilCont.document.getElementById('body').style.visibility='visible';
		//top.utilCont.document.getElementById('conForm').style.visibility='visible';
	}
	else if (flag == 'badPass')
	{
		theWin.style.height='170px';
		theWin.style.width='300px';
		theWin.style.top=Math.round((winH-170)/2)+top.document.body.scrollTop;
		theWin.style.left=Math.round((winW-300)/2);
		
		top.document.getElementById('utilCont').src="/windows/badPass.html";
		theFrame.style.height='160px';
		theFrame.style.width='280px';
	}
	else if (flag == 'badUser')
	{
		theWin.style.height='170px';
		theWin.style.width='300px';
		theWin.style.top=Math.round((winH-170)/2)+top.document.body.scrollTop;
		theWin.style.left=Math.round((winW-300)/2);
		
		top.document.getElementById('utilCont').src="/windows/badUser.html";
		theFrame.style.height='160px';
		theFrame.style.width='280px';
	}
	else if (flag == 'wrongUser')
	{
		theWin.style.height='170px';
		theWin.style.width='300px';
		theWin.style.top=Math.round((winH-170)/2)+top.document.body.scrollTop;
		theWin.style.left=Math.round((winW-300)/2);
		
		top.document.getElementById('utilCont').src="/windows/wrongUser.html";
		theFrame.style.height='160px';
		theFrame.style.width='280px';
	}
	theWin.className='vis';
	//theWin.document.getElementById('body').style.visibility='visible';
	
}

function hideUtility(theForm)
{
	//top.document.getElementById('body').style.overflow="scroll";
	var theGray=top.document.getElementById('gray');
	//alert(parent.document.getElementById('body').offsetHeight);
	theGray.className='invis';
	theGray.style.width='0px';
	var theWin=top.document.getElementById('utility');
	if (isWin == false)
	{
		//top.main.document.getElementById('logo').style.width=winW-15;
	}
	if (top.bovine.offsetWidth > 0)
	{
		top.bovine.style.width=winW-15;
	}
	try
	{
		top.utilCont.document.getElementById('conForm').style.visibility='hidden';
	}
	catch(err)
	{
	}
	top.utilCont.document.getElementById('body').style.visibility="hidden";
	//top.main.document.getElementById('container').style.left="0px";
	theWin.className='invis';
	//alert(top.where);
	//if ((top.proH > winH) || (
	//{
		top.document.getElementById('body').style.overflowY="scroll";
	//}
}


function sizeUtility()
{
	var theWin=top.document.getElementById('utility');
	
	var theFrame=top.document.getElementById('utilCont');
	
	theWin.style.height='130px';
	theWin.style.width='300px';
	theWin.style.top=Math.round((winH-130)/2)+top.main.document.body.scrollTop;
	theWin.style.left=Math.round((winW-300)/2);
	
	theFrame.style.height='110px';
	theFrame.style.width='280px';
		
}

function setCookie(id, loc, bovLoc)
{
	var expiry = new Date();
	expiry.setTime(expiry.getTime() + (365*24*60*60*1000));
	document.cookie="uid="+id+","+loc+","+bovLoc+";"+"expires="+expiry.toGMTString()+";";
}


function killCookie()
{
	var expiry = new Date();
	expiry.setTime(expiry.getTime() -1);
	document.cookie="uid=; path=/; expires="+expiry.toGMTString()+";";
	//	top.document.getElementById('login').src="";
}

function logout()
{
	var user=top.login.document.getElementById('body').innerHTML;
	
	//alert(user);
	top.document.forms.logout.user.value=user
	
	top.document.forms.logout.submit();
	
	//var expiry = new Date();
	//expiry.setTime(expiry.getTime() -1);
	//document.cookie="uid="+cookieId+"; path=/; expires="+expiry.toGMTString()+";";
}

function commHandle(val)
{
	var actTest;
	//alert(actTest);
	if (top.isActive == 0)
	{
		var myCookie=document.cookie;
		
		//alert(myCookie);
		if (myCookie != "")
		{
			var cookieArr=myCookie.split('=');
			var cookieData=cookieArr[1];
			var dataArr=cookieData.split(',');
			actTest=dataArr[3];
		}
		
		if (actTest=='active')
		{
			
			top.isActive=1;
		}
		else
		{
			top.isActive=0;
		}
		
	}
	
	//alert(parent.isActive);
	var showThis;
	if (val=='bov')
	{
		showThis='bov';
	}
	else
	{
		top.whichPost=val;
		showThis='comm'
	}
	var theTest=top.login.document.getElementById('body').innerHTML;
	if (theTest.substring(0,4) != 'null')
	{
		//alert(1);
		if (top.isActive == 1)
		{
			//alert(showThis);
			top.showUtility(showThis);
			top.theUser=theTest;
		}
		else if ((top.isActive==0) && (val != 'bov'))
		{
			top.showUtility('notActive');
			top.theUser=theTest;
		}
		else if ((top.isActive==0) && (val == 'bov'))
		{
			top.showUtility('notActive', parent.theUser, 'bov');
			top.theUser=theTest;
		}
	}
	else
	{
		if (val == 'bov')
		{
			top.makeComm=2;
		}
		else
		{
			top.makeComm=1;
		}
		top.showUtility('log');
	}
}

function checkBov()
{
	var theData=document.cookie;
	var dataArr=theData.split(',');
	return dataArr[2];
}