function setCookie(id,section)
{
	document.cookie="ng.id="+id;
	document.cookie="ng.section="+section;
}

function getCookie(cname)
{
	var carr=document.cookie.split("; ");
	cname="ng."+cname;
	for (i=0; i<carr.length; i++)
	{
		tmp=carr[i].split("=");
		if (tmp[0]==cname)
		{
			return tmp[1];
		}
	}
	return null;
}

function selectID(id,section)
{
	setCookie(id,section);
	document.location=section;
}

function menu()
{
//	alert(getCookie("id"));
	if (getCookie("id")==null)
	{
		document.if1.document.location="generalmenu.html";
	}
	else
	{
		document.if1.document.location=getCookie("id");
	}

	scrollnow();

}

function preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function swapImgRestore() { //v3.0
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


function swapImage() { //v3.0
  var i,j=0,x,a=swapImage.arguments;
  var tmp=parent.document.location.href.split("/");
  var sec=tmp[tmp.length-1];

  document.sr=new Array;
  for(i=0;i<(a.length-3);i+=3)
  {
	if ((x=findObj(a[i]))!=null)
	{
		document.sr[j++]=x;
		if (a[a.length-1]!=sec)
		{
			if(!x.oSrc) x.oSrc=x.src;
			x.src=a[i+2];
		}
	}
  }
}

function callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function newin2(url,w,h){
  str =  "toolbar=no,width="+w+",height="+h+",directories=no,status=no,scrollbars=auto,resize=no,menubar=no"
  newWindow = window.open(url,"",str).focus();
}

function writeBrowsebutton()
{
//	document.write ('<div id="browsebtn" style="position:absolute; width:223px; height:80px; z-index:3; left: 540px; top: 100px"><a href=http://gs.ilongman.com target=_blank><img src="images/browsing_button.gif" border=0></a></div>')
}


function scrollinit()
{
//	var broswerHeight;
//	var imgHeight = 80;
//	broswerHeight = (document.body.scrollTop + document.body.clientHeight - imgHeight) - 5;

//	if (document.all.browsebtn != null) {
//		document.all.browsebtn.style.top = broswerHeight;
//	}
}

function scrollnow()
{
//	setInterval("scrollinit()", 50);
}

function gotoPage(obj)
{
	pagevalue=obj.options[obj.selectedIndex].value;
	loc="question.php?wID="+pagevalue;
	location=loc;
}

function store(newsdoc)
{
 	document.form1.newsdoc.value = newsdoc;
	document.form1.submit();

}