//window.onload = function() {
//}
// POPUP WINDOW
function openPopup(popPage, width, height) {
   var randomnumber=Math.floor(Math.random()*99999999)
   x = (640 - width)/2, y = (480 - height)/2;
   if (screen) {
      y = (screen.availHeight - height)/2;
      x = (screen.availWidth - width)/2;
   }
   popWin = window.open(popPage,randomnumber,'width='+width+',height='+height+',screenX='+x+',screenY='+y+',top='+y+',left='+x+',resizable=no,scrollbars=yes');
}

//fix indexOf for IE.
if(!Array.indexOf){
	Array.prototype.indexOf = function(obj){
		for(var i=0; i<this.length; i++){
			if(this[i]==obj){
				return i;}
	        }
		return -1;
	    }
}

//-->
// LOAD FLASH
function loadflash(flashfile, width, height, finalwidth) {
   var sizeratio = finalwidth / width;
   var finalheight = height * sizeratio;
   return('<embed src="'+flashfile+'" quality=high WIDTH="'+(finalwidth)+'" HEIGHT="'+finalheight+'" ALIGN="left" TYPE="application/x-shockwave-flash" PLUGINSPAGE="https://www.macromedia.com/go/getflashplayer">');	
}
//-->
// NAV BUTTON OVER
function navbuttover(navid,colorhex,tright,bright,tleft,bleft,tl,tlr,tld,tr,trr,trd,bl,blr,bld,br,brr,brd) {
   document.getElementById('navbutton_'+navid).style.background=colorhex;
   if (tr != 0) {
	  rpt = 'no-repeat';
	  if (tlr == 1 && tld == 1) { rpt = 'repeat-x'; }
	  if (tlr == 1 && tld == 2) { rpt = 'repeat-y'; }
      document.getElementById('navbutton_tright_'+navid).style.background='url(/site_images/'+tright+') top right '+rpt;
   }
   if (br != 0) {
	  rpt = 'no-repeat';
	  if (trr == 1 && trd == 1) { rpt = 'repeat-x'; }
	  if (trr == 1 && trd == 2) { rpt = 'repeat-y'; }
      document.getElementById('navbutton_bright_'+navid).style.background='url(/site_images/'+bright+') bottom right '+rpt;
   }
   if (tl != 0) {
	  rpt = 'no-repeat';
	  if (blr == 1 && bld == 1) { rpt = 'repeat-x'; }
	  if (blr == 1 && bld == 2) { rpt = 'repeat-y'; }
      document.getElementById('navbutton_tleft_'+navid).style.background='url(/site_images/'+tleft+') top left '+rpt;
   }
   if (bl != 0) {
	  rpt = 'no-repeat';
	  if (brr == 1 && brd == 1) { rpt = 'repeat-x'; }
	  if (brr == 1 && brd == 2) { rpt = 'repeat-y'; }
      document.getElementById('navbutton_bleft_'+navid).style.background='url(/site_images/'+bleft+') bottom left '+rpt;
   }
}
//-->
// DROPDOWN MENU
function dropdownmenu(buttons,pageids,butttype,buttnum,buttobj,buttstatus,layout,butthighlight,buttnumid,buttontarget,buttonnofollow) {
   if (buttstatus == 1 && buttnum) { 
      // ADD TEXT
	  eval(winsize());
	  var buttonsget = buttons;
      var buttons_array=buttonsget.split("||");
	  var buttontargetget = buttontarget;
      var buttontarget_array=buttontargetget.split("||");
	  var buttonnofollowget = buttonnofollow;
      var buttonnofollow_array=buttonnofollowget.split("||");
	  var pageidsget = pageids;
      var pageids_array=pageidsget.split(",");
	  var butttypeget = butttype;
      var butttype_array=butttypeget.split(",");
      var textsetup = '';
	  
	  for (i=0;i<buttnum;i++) {
		 if (butttype_array[i] == 1) {
	        var butttypeset = 'window.location = \''; 
			var butttypeset_cl = '\''; 
			var butttarget = "_self";
		 } else {
            var butttypeset = 'window.open(\''; 
		    var butttypeset_cl = '\')'; 
			var butttarget = "_self";
		 }
		 if (i==(buttnum-1)) {
			var buttclass = "dropdownbuttbottom"; 
		 } else {
			var buttclass = "dropdownbutt"; 
		 }
		 var nofollowset='';
		 if (buttonnofollow_array[i]==1) {
			nofollowset='rel="nofollow"'; 
		 }
	     var textsetup = textsetup+'<a href="'+pageids_array[i]+'" '+nofollowset+' onclick="goosite_createCookie(\'goosite_pagenum\','+buttnumid+')" target="'+buttontarget_array[i]+'" style="text-decoration:none;"><div class="'+buttclass+' navbuttontext" id="dropdownbutton'+i+'" onmouseover="document.getElementById(\'dropdownbutton'+i+'\').style.background=\''+butthighlight+'\'" onmouseout="document.getElementById(\'dropdownbutton'+i+'\').style.background=\'\'">'+buttons_array[i]+'</div></a>';
	  }
	  document.getElementById('dropdownmenutext').innerHTML = textsetup;
	  if (layout==1) {
         var posx = (findPos(document.getElementById(buttobj),2)*1);
	     var posy = (findPos(document.getElementById(buttobj),1)*1)+(findDim(document.getElementById(buttobj),2)*1);
	     var posx_inwrap = findPos(document.getElementById(buttobj),2)-findPos(document.getElementById('wrapper'),2);
	     var sitepadding = (findPos(document.getElementById('sitebanner'),2)*1) - (findPos(document.getElementById('wrapper'),2)*1);
	     //document.getElementById(buttobj).style.border = "1px solid #000000";
	     //alert(document.getElementById('wrapper').offsetLeft);
	     if ((posx_inwrap + findDim(document.getElementById('dropdownmenubox'),1)*1) > (document.getElementById('wrapper').offsetWidth)) {
	        posx = (findPos(document.getElementById(buttobj),2)*1)-((posx_inwrap + findDim(document.getElementById('dropdownmenubox'),1)*1)-(findDim(document.getElementById('wrapper'),1)*1))-sitepadding;
	     }
		 document.getElementById('dropdownmenuboxoff').style.left=(findPos(document.getElementById('wrapper'),2)*1);
	     document.getElementById('dropdownmenuboxoff').style.top=0;
		 document.getElementById('dropdownmenuboxoff').style.width=findDim(document.getElementById('wrapper'),1);
	  } else if (layout==2) {
	     var posx = (findPos(document.getElementById(buttobj),2)*1)+(findDim(document.getElementById(buttobj),1)*1);
	     var posy = (findPos(document.getElementById(buttobj),1)*1);	
		 document.getElementById('dropdownmenuboxoff').style.left=(findPos(document.getElementById(buttobj),2)*1)+(findDim(document.getElementById(buttobj),1)*1);
	     document.getElementById('dropdownmenuboxoff').style.top=0;
		 document.getElementById('dropdownmenuboxoff').style.width=findDim(document.getElementById('wrapper'),1)-findDim(document.getElementById('nav'),1);
	  }
	  document.getElementById('dropdownmenubox').style.left=posx;
	  document.getElementById('dropdownmenubox').style.top=posy;
	  document.getElementById('dropdownmenuboxshadow').style.left=posx+5;
	  document.getElementById('dropdownmenuboxshadow').style.top=posy+5;
	  document.getElementById('dropdownmenuboxshadow').style.height=findDim(document.getElementById('dropdownmenubox'),2);
	  document.getElementById('dropdownmenuboxoff').style.height=findDim(document.getElementById('wrapper'),2);
   } else {
      document.getElementById('dropdownmenubox').style.left=-10000;
	  document.getElementById('dropdownmenuboxshadow').style.left=-10000;
	  document.getElementById('dropdownmenuboxoff').style.left=-10000;
	  document.getElementById('dropdownmenuboxoff').style.width=0;
	  document.getElementById('dropdownmenuboxoff').style.height=0;
   }
   //
   //image'.$i.'.src=\'site_images/'.$image_on_r.'\';	
}
//-->
// FIND POSITION
function findPos(obj,type) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	//return [curleft,curtop];
	if (type==1) {
	   return [curtop];
	}
	if (type==2) {
	   return [curleft];	
	}
}
function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

//-->
// FIND WIDTH AND HEIGHT
// FIND POSITION
function findDim(obj,type) {
	var curwidth = curheight = 0;
	if (obj.offsetParent) {
		curwidth = obj.offsetWidth
		curheight = obj.offsetHeight
	}
	//return [curleft,curtop];
	if (type==1) {
	   return [curwidth];
	}
	if (type==2) {
	   return [curheight];	
	}
}
// SHOW NAV
function shownav() {
   document.getElementById('nav').style.display='block'; 
}
//-->
// WINDOW WIDTH AND HEIGHT - eval() on return value
function winsize() {
   var myWidth = 0, myHeight = 0;
   if( typeof( window.innerWidth ) == 'number' ) {
      //Non-IE
       myWidth = window.innerWidth;
       myHeight = window.innerHeight;
	   if (myHeight > document.body.scrollHeight) {
	      scrollHeight = myHeight;
	   } else {
		  scrollHeight = document.body.scrollHeight;   
	   } 
   } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
       //IE 6+ in 'standards compliant mode'
       myWidth = document.documentElement.clientWidth;
       myHeight = document.documentElement.clientHeight;
	   if (myHeight > document.documentElement.scrollHeight) {
	      scrollHeight = myHeight;
	   } else {
		  scrollHeight = document.documentElement.scrollHeight;   
	   }
   } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
       //IE 4 compatible
       myWidth = document.body.clientWidth;
       myHeight = document.body.clientHeight;
	   if (myHeight > document.body.scrollHeight) {
	      scrollHeight = myHeight;
	   } else {
		  scrollHeight = document.body.scrollHeight;   
	   }
   }
   
   return("var winwidth = "+myWidth+";var winheight = "+myHeight+";var scrollheight = "+scrollHeight+";");
}
// -->
// FRONT END GOOJAX

// GOOJAX FORM SUBMISSION
   var http_request = false;
   function makePOSTRequest(url,parameters,loadspan,loadtype,callback) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
	  http_request.onreadystatechange = function() { alertContents(http_request,loadspan,loadtype,callback); };	  http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      //http_request.setRequestHeader("Content-length", parameters.length);
      //http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }
   function alertContents(http_request,loadspan,loadtype,callback) {
      if (http_request.readyState == 4) {
		 //alert(http_request.status);
		 if (http_request.status == 200) {
			result = http_request.responseText;
			if (loadspan) {
			   document.getElementById(loadspan).innerHTML = result;
			   
			if (loadtype == 1) {
				  // CHECK TYPE OPTIONS
				  var strsearch = document.getElementById(loadspan).innerHTML;
				  if (strsearch.search('msgwinsort') != -1) {
					 goojax_msg_open(1);  
				  } else {
			         goojax_msg_open('');
				  }
			   }
			   eval(callback);
			} else {
			   eval(result);
			   if (loadtype == 1) {
			      //setTimeout("goojax_msg_close()",1000);
				  goojax_msg_close();
			   }  	
			}
         } else {
            //alert('Oops!  There was a small hiccup.  Press OK to continue.');
         }
      }
   }
function goojax_saveformdata(formlist,url,save) {      
   var getstr = '';
   var formlist_array=formlist.split(",");
   for (j=0; j<formlist_array.length; j++) {
	   obj=document.getElementById(formlist_array[j]);
      for (i=0; i<obj.length; i++) {
         var theElement = obj.elements[i];
         var element_type = theElement.type;
         var element_name = theElement.name;
         var element_value = theElement.value;
	     var typelist = typelist + element_type + ',';
	     if (element_type == "text" && element_value) {
	        getstr += element_name+"="+escape(element_value)+"&";
	     }
	     if (element_type == "password" && element_value) {
	        getstr += element_name+"="+escape(element_value)+"&";
	     }
	     if (element_type == "textarea" && element_value) {
	        getstr += element_name+"="+escape(element_value)+"&";
	     }
	     if (element_type == "hidden" && element_value) {
	        getstr += element_name+"="+escape(element_value)+"&";
	     }
	     if (element_type == "select-one" && element_value) {
	        getstr += element_name+"="+escape(element_value)+"&";
	     }
	     if (element_type == "select-multiple") {
		    var selectlist = '';
		    var opt = document.getElementById(element_name).length;
		    for (k=0;k<opt;k++) {
			   selectlist += document.getElementById(element_name).options[ k ].value+",";
		    }
			var selectlist = selectlist.replace(/\,$/,'');
		    getstr += element_name+"="+selectlist+"&";
	     }
	     if (element_type == "checkbox") {
            if (theElement.checked == true) {
		       getstr += element_name+"="+element_value+"&";
		    } else {
			   getstr += element_name+"=&"; 
		    }
	     }
	     if (element_type == "radio") {
            if (theElement.checked == true) {
		       getstr += element_name+"="+element_value+"&";
		    }
	     }
      }
   }
   //alert(getstr);
   if (save!=1) {
      goojax_msg_save();
	  makePOSTRequest(url,getstr,'','1');
   } else {
	  makePOSTRequest(url,getstr,'',''); 
   }
   
}
function goojax_savedata(obj,url) {      
   var getstr = '';
   for (i=0; i<obj.length; i++) {
	   
      var theElement = obj.elements[i];
      var element_type = theElement.type;
      var element_name = theElement.name;
      var element_value = theElement.value;
	  //alert(theElement.name+' '+obj.elements[i].value);
	  var typelist = typelist + element_type + ',';
	  if (element_type == "text" && element_value) {
	     getstr += element_name+"="+escape(element_value)+"&";
	  }
	  if (element_type == "password" && element_value) {
	     getstr += element_name+"="+escape(element_value)+"&";
	  }
	  if (element_type == "textarea" && element_value) {
	     getstr += element_name+"="+escape(element_value)+"&";
	  }
	  if (element_type == "hidden" && element_value) {
	     getstr += element_name+"="+escape(element_value)+"&";
	  }
	  if (element_type == "select-one" && element_value) {
	     getstr += element_name+"="+escape(element_value)+"&";
	  }
	  if (element_type == "select-multiple" && element_value) {
		 var selectlist = '';
		 var opt = document.getElementById(element_name).length;
		 for (j=1;j<opt;j++) {
			if (document.getElementById(element_name).options[ j ].selected) {
			   selectlist += document.getElementById(element_name).options[ j ].value+",";
			}
		 }
		 getstr += element_name+"="+selectlist+"&";
	  }
	  if (element_type == "checkbox") {
         if (theElement.checked == true) {
		    getstr += element_name+"="+element_value+"&";
		 } else {
			getstr += element_name+"=&"; 
		 }
	  }
	  if (element_type == "radio") {
         if (theElement.checked == true) {
		    getstr += element_name+"="+element_value+"&";
		 }
	  }
   }
   //alert(getstr);
   goojax_msg_save();
   makePOSTRequest(url,getstr,'','1');
}
// -->

// GOOJAX MESSAGE WINDOW
function goojax_msg_custom(url,data,callback) {
   makePOSTRequest(url,data,'msgbox','1',callback);    
}
function goojax_msg_save() {
   //document.getElementById('msgbox').innerHTML = '<table class="popupframe" width="300" height="100" border="0" cellpadding="0" cellspacing="0"><tr><td><span class="subheaders-white"><center>Saving Changes</center></span></td></tr></table>'; 
   //document.getElementById('msgbox').innerHTML = '<div style="height:100px;width:100px;"><embed src="/gooimages/pleasewait.swf" quality=high WIDTH="100" HEIGHT="100" ALIGN="center" TYPE="application/x-shockwave-flash" PLUGINSPAGE="https://www.macromedia.com/go/getflashplayer" wmode="transparent"></div>'; 
   document.getElementById('msgbox').innerHTML = '<div style="height:100px;width:100px;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="100" height="100" id="pleasewait" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="/gooimages/site_pleasewait.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#666666" /><embed src="/gooimages/site_pleasewait.swf" quality="high" wmode="transparent" bgcolor="#666666" width="100" height="100" name="pleasewait" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer" /></object></div>'; 
   goojax_msg_open('');	
}
function goojax_msg_delete(delfunc,delmsg,delsubmsg) {
   if (delmsg) {
      var delmsg = ' '+delmsg;   
   }
   if (delsubmsg) {
	  var delsubmsg = '<br><span class="bodytext-white">'+delsubmsg;   
   }
   document.getElementById('msgbox').innerHTML = '<table width="450" height="200" border="0" cellpadding="0" cellspacing="0"><tr><td valign="middle" bgcolor="#330033" class="popupframe"><div align="center"><p align="center"><span class="subheaders-white">Are you sure you want to delete this'+delmsg+'?</span>'+delsubmsg+'</p><div align="center"><input name="Submit2" type="button" class="popupbutton" value="Nevermind" onClick="goojax_msg_close();"> <input name="Submit3" type="button" class="popupbutton" value="Yes" onClick="'+delfunc+'"></div></div></td></tr></table>'; 
   goojax_msg_open('');	
}
function goojax_msg_open(type) {
   // SET TYPES
   if (type == 1) { // LOAD SORT
      dragsort.makeListSortable(document.getElementById('msgwinsort'),verticalOnly, saveOrder);
   }
   eval(winsize());
   var width = document.getElementById('msgbox').offsetWidth/2;
   var height = document.getElementById('msgbox').offsetHeight/2;
   document.getElementById('msgbox').style.top=document.body.scrollTop+(winheight/2)-height;
   document.getElementById('msgbox').style.left = winwidth/2-width;
   document.getElementById('msgboxshadow').style.top=0;
   document.getElementById('msgboxshadow').style.left =0;
   document.getElementById('msgboxshadow').style.width='100%';
   document.getElementById('msgboxshadow').style.height = scrollheight; 
}
function goojax_imagebox_open() {
   eval(winsize());
   var width = document.getElementById('imagebox').offsetWidth/2;
   var height = document.getElementById('imagebox').offsetHeight/2;
   document.getElementById('imagebox').style.top=document.body.scrollTop+(winheight/2)-height;
   document.getElementById('imagebox').style.left = winwidth/2-width;
   document.getElementById('imageboxshadow').style.width=document.getElementById('imagebox').offsetWidth+40;
   document.getElementById('imageboxshadow').style.height = document.getElementById('imagebox').offsetHeight+40; 
   document.getElementById('imageboxshadow').style.top=document.body.scrollTop+(winheight/2)-(height+20);
   document.getElementById('imageboxshadow').style.left = winwidth/2-(width+20);
   document.getElementById('msgbox').innerHTML = '';
}
function goojax_msg_adjust() {
   eval(winsize());
   var width = document.getElementById('msgbox').offsetWidth/2;
   var height = document.getElementById('msgbox').offsetHeight/2;
   document.getElementById('msgbox').style.top=document.body.scrollTop+(winheight/2)-height;
   document.getElementById('msgbox').style.left = winwidth/2-width;  	
}
function goojax_msg_close() {
   if (document.getElementById('openafter')) { 
      eval(document.getElementById('openafter').value);
	  document.getElementById('openafter').value = '';
   }
   document.getElementById('msgbox').style.top=-10000;
   document.getElementById('msgbox').style.left = -10000;
   document.getElementById('msgboxshadow').style.top=-10000;
   document.getElementById('msgboxshadow').style.left = -10000;	
}
function goojax_imagebox_close() {
   document.getElementById('imagebox').style.top=-10000;
   document.getElementById('imagebox').style.left = -10000;
   document.getElementById('imageboxshadow').style.top=-10000;
   document.getElementById('imageboxshadow').style.left = -10000;	
   goojax_msg_close();
}
function goojax_msgbox_close() {
   document.getElementById('msgbox').style.top=-10000;
   document.getElementById('msgbox').style.left = -10000;
}
function goojax_load_data(url,data,loadspan) {
   makePOSTRequest(url,data,'','2');    
}
// -->
// IMAGE LARGE VIEW WITH MULTIPLE
function gooimagebox_open(imglist,desclist,w) {
   goojax_msg_save();
   if (!w) {
      w=700;
	  h=700;
   }
   //imgPreloader = new Image();
   //imgPreloader.onload=function(){
	  //imgPreloader.onload=function(){};
      document.getElementById('imageboxspan').innerHTML = '<table border="0" border="0" cellpadding="0" cellspacing="0"><tr><td colspan="2"><a href="javascript:goojax_imagebox_close()"><img border="0" id="img1" src="/googlobal/site_imagedis.php?img=lg_'+imglist+'&w='+w+'&h='+w+'&constrain=1" onload="goojax_imagebox_open()"/></a></td></tr><tr><td class="bodytext-white"><h1>'+unescape(desclist)+'</h1></td><td nowrap align="right" class="bodytext-white"><h1 style="display:inline;"><a href="javascript:goojax_imagebox_close()">Close</a></h1></td></tr></table>';
      //goojax_imagebox_open('');  
   //}
   //imgPreloader.src = '/googlobal/site_imagedis.php?img=lg_'+imglist+'&w='+w;
   //document.getElementById('msgbox').innerHTML = '<div style="width:100px;height:100px;"><center><img src="/gooimages/loading.gif"/></center></div>';
   //goojax_msg_open();
   //document.getElementById('msgboxshadow').style.filter = 'alpha(opacity=100)';
   //document.write('<div id="foobox" style="height:25px;width:25px;background:#000000;;z-index:802;position:absolute;left:100px;top:100px;"><span id="imgspots"><img id="img1" src="/userimages/'+imglist+'" width="'+imgx+'" height="'+imgy+'"/></span></div>');
}
// -->
// WINDOW WIDTH AND HEIGHT - eval() on return value
function winsize() {
   var myWidth = 0, myHeight = 0;
   if( typeof( window.innerWidth ) == 'number' ) {
      //Non-IE
       myWidth = window.innerWidth;
       myHeight = window.innerHeight;
	   if (myHeight > document.body.scrollHeight) {
	      scrollHeight = myHeight;
	   } else {
		  scrollHeight = document.body.scrollHeight;   
	   } 
   } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
       //IE 6+ in 'standards compliant mode'
       myWidth = document.documentElement.clientWidth;
       myHeight = document.documentElement.clientHeight;
	   if (myHeight > document.documentElement.scrollHeight) {
	      scrollHeight = myHeight;
	   } else {
		  scrollHeight = document.documentElement.scrollHeight;   
	   }
   } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
       //IE 4 compatible
       myWidth = document.body.clientWidth;
       myHeight = document.body.clientHeight;
	   if (myHeight > document.body.scrollHeight) {
	      scrollHeight = myHeight;
	   } else {
		  scrollHeight = document.body.scrollHeight;   
	   }
   }
   
   return("var winwidth = "+myWidth+";var winheight = "+myHeight+";var scrollheight = "+scrollHeight+";");
}
// -->
// CHECK IF VALID EMAIL
function checkemail(field) {
	var x = document.getElementById(field).value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) return('1');
	else return('2');
}
// -->
// ADD SLASHES
function goo_addslashes(str) {
	str=str.replace(/\'/g,'\\\'');
	str=str.replace(/\"/g,'\\"');
	str=str.replace(/\\/g,'\\\\');
	str=str.replace(/\0/g,'\\0');
	return str;
}
// -->
// STRIP SLASHES
function goo_stripslashes(str) {
	str=str.replace(/\\'/g,'\'');
	str=str.replace(/\\"/g,'"');
	str=str.replace(/\\\\/g,'\\');
	str=str.replace(/\\0/g,'\0');
	return str;
}

// COOKIE FUNCTIONS
function goosite_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 = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function goosite_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;
}

function goosite_eraseCookie(name) {
	goosite_createCookie(name,"",-1);
}
// SITE CONTENT DIRECTOR
function goojax_msg_cd(type,field,span,size,autoul) {
   eval(winsize());
   var width = document.getElementById('goocdwin').offsetWidth/2;
   var height = document.getElementById('goocdwin').offsetHeight/2;
   document.getElementById('goocdwin').style.top=document.body.scrollTop+(winheight/2)-height;
   document.getElementById('goocdwin').style.left = winwidth/2-width;
   document.getElementById('goocdwin').style.zIndex = 100001;
   document.getElementById('msgboxshadow').style.top=0;
   document.getElementById('msgboxshadow').style.left =0;
   document.getElementById('msgboxshadow').style.width='100%';
   document.getElementById('msgboxshadow').style.height = scrollheight;
   document.getElementById('msgboxshadow').style.zIndex = 100000;
   window.frames.goocdframe.goocd_winuse_setvars(type,field,span,size,autoul);
   // RUN AUTO UPLOAD
   if (autoul) {
	   var contenttype=0;
	   if (type==1) contenttype=5;
	   if (type==2) contenttype=4;
	   window.frames.goocdframe.openeditdialog('','','',2,'','',contenttype,'');
   }
}
function goojax_msg_cd_close() {
   document.getElementById('goocdwin').style.top=-10000;
   document.getElementById('goocdwin').style.left = -10000;
   document.getElementById('goocdwin').style.zIndex = 802;
   document.getElementById('msgboxshadow').style.top=-10000;
   document.getElementById('msgboxshadow').style.left = -10000;	
   document.getElementById('msgboxshadow').style.zIndex = 799;
}
// ENTER KEY
function goostopRKey(evt) { 
  var evt = (evt) ? evt : ((event) ? event : null); 
  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); 
  if ((evt.keyCode == 13) && (node.type=="text"||node.type=="password"))  {return false;} 
} 

//document.onkeypress = goostopRKey;
function goosubmitenter(myfield,e,callback,callbackvalue) {
   var keycode;
   if (window.event) keycode = window.event.keyCode;
   else if (e) keycode = e.which;
   else return true;
	
   if (keycode == 13) {
      callback(callbackvalue);
	  return false;
   } else
	   return true;
}

// RESTRICT FIELD BY NUMBER
function goonumbersonly(e,x) {
	if(x) {
	    useOnlyVowels = true; 
		myfield = document.getElementById(x); 
		data=myfield.value;
		noletters = /[a-zA-Z]/ig;
		data = data.replace(noletters,"");  
		myfield.value=data;
	}
	var unicode=e.charCode? e.charCode : e.keyCode
	if (unicode==46) return;
	if (unicode!=8){ //if the key isn't the backspace key (which we should allow)
	if (unicode<48||unicode>57) //if not a number
		return false //disable key press
	}
}

// SITE USERACCOUNT USER MENU
function goo_siteaccount_menu() {
	alert(document.getElementById('goo_loginbar').offsetLeft+" "+document.getElementById('goo_loginbar').offsetTop);	
}
