//var Auto=0 ;
var $g_PageContent ;
var $g_Body ;

/*
// Check if a suitable browser for script actions
browsok = (((navigator.appName == "Netscape")
	&& (parseInt(navigator.appVersion) >= 3))
	|| ((navigator.appName == "Microsoft Internet Explorer")
	&& (parseInt(navigator.appVersion) >= 3))
	|| ((navigator.appName == "Opera")
	&& (parseInt(navigator.appVersion)>=7)));
*/

function MyMailTo($who)
{
	var $newwho ;
	var $mail ;

	$newwho = "" ;
	for (i=$who.length-1; i>=0; i--)
	{
		$newwho += $who.substr(i,1) ;
	}
	$mail = "mailto:" + $newwho ;
	$mail = $mail.replace(/=/, "@") ;
	$mail = $mail.replace(/~/g, ".") ;
	document.location=$mail ;
}

function dogoogle()
{
	var $terms ;

	$terms = document.searchForm.searchTerm.value ;
	$terms = $terms.replace(/ /g, '+') ;
	$terms = escape($terms) ;
	document.location = "http://www.google.com/search?q=site:<?php echo($_SERVER['HTTP_HOST']);?>+" + $terms ;
    return false ;
}
/*
// Image Mouse On
function BNB_mouseon(him)
{
    if(browsok && ("iGallery" in document))
	{
	    Ix = him.getAttribute('PopsIx') ;
		if (Ix)
	    {
        	document["iGallery"].src = Pic[Ix].src ;
        	document["iGallery"].alt = Txt[Ix] ;
        	document["iGallery"].title = Txt[Ix] ;
        	document.getElementById('cGallery').innerHTML = Txt[Ix] ;
        	MenuHover=1 ;
    	}
		him.style.color="#<?php echo ($MenuOn) ; ?>" ;
    }
}
// Image Mouse Off
function BNB_mouseoff(him)
{
    if(browsok && ("iGallery" in document))
    {
	    if (Auto==0)
	    {
			document ["iGallery"].src = Pic0.src;
        	document["iGallery"].alt = Txt[0] ;
        	document["iGallery"].title = Txt[0] ;
        	document.getElementById('cGallery').innerHTML = Txt[0] ;
		}
		him.style.color="#<?php echo ($MenuOff) ; ?>" ;
        MenuHover=0 ;
    }
}
*/

function newcont($url)
{
	if ($g_PageContent == undefined)
		$g_PageContent = document.getElementById("pagecontent") ;
	if ($g_Body == undefined)
		$g_Body = document.getElementById('mybody') ;

	if ($url.substr(0,12) == '/gallery.php')
	{
		var $page = $url.substr(12) ;
		if ($page.substr(0,6) == '?page=')
			$page = '/' + $page.substr(7) ;
//alert (page) ;
		RunGallery($page) ;
	}
	else
	{
//alert($url) ;

  		var $class;
  		try { $class = new ActiveXObject("Msxml2.XMLHTTP"); }
  		catch ($e) { try { $class = new ActiveXObject("Microsoft.XMLHTTP"); }
  		catch ($e) { try { $class = new XMLHttpRequest(); }
  		catch ($e) { $class = false; }}}
  		if (!$class) return null;
//alert ($class) ;
		var $parts = $url.split("#") ;
		$url = $parts[0] ;
		$anchor = $parts[1] ;

		if ($url.indexOf("?") == -1)
			$url += "?RAW=1" ;
		else
			$url += "&RAW=1" ;
//alert ($url) ;
		$class.open("GET", $url, true);
	    $class.onreadystatechange = function()
	    {
			if ($class.readyState == 4 && $class.status == 200)
			{
				if ($class.responseText)
				{
					var $resp = $class.responseText ;
//alert ($resp) ;
	        		$g_PageContent.innerHTML = $resp ;
//alert ($anchor) ;
	        		var $down = 0 ;
	        		if ($anchor)
	        		{
		        		var $anc = document.getElementById($anchor) ;
		        		$down += findY($anc) - findY($g_PageContent) ; ;
//alert($down) ;
        			}
					$g_Body.scrollTop = $down ;
				}
			}
		}
		$class.send("");
	}
}

function findY($obj)
{
	var $curtop = 0;
	if ($obj.offsetParent)
	{
		$curtop = $obj.offsetTop
		while ($obj = $obj.offsetParent)
			$curtop += $obj.offsetTop
	}
	return [$curtop];
}

function popupvid($mylink, $windowname)
{
	if (! window.focus)return true;
	var $href;

	if (typeof($mylink) == 'string')
   		$href=$mylink;
	else
   		$href=$mylink.href;
	window.open($href, $windowname, 'width=335,height=275,scrollbars=no,resizable=no,status=no');
	return false;
}

function playSound($soundname)
{
	var $sound = eval("document." + $soundname);

	// make an effort to stop and rewind any playback
	// already in progress so that the sound starts over.
	// Otherwise this call has no effect when the sound
	// is already in progress. You can remove these lines
	// if you don't like this behavior.
	try
	{
		$sound.Stop();
		$sound.Rewind();
	}
	catch (e)
	{
		// A player that doesn't support
		// Stop and Rewind
	}

	try
	{
		// For RealPlayer-enabled browsers.
		// Some versions of RealPlayer do not
		// offer a Play() function and will
		// fail to play sound if we try to
		// call Play().
		$sound.DoPlay();
	}
	catch (e)
	{
		// If DoPlay doesn't work, call Play.
		// This works for all other audio
		// plug-ins.
		$sound.Play();
	}
}

function stopSound($soundname)
{
	var $sound = eval("document." + $soundname);

	// make an effort to stop and rewind any playback
	// already in progress so that the sound starts over.
	// Otherwise this call has no effect when the sound
	// is already in progress. You can remove these lines
	// if you don't like this behavior.
	try
	{
		$sound.Stop();
		$sound.Rewind();
	}
	catch (e)
	{
		// A player that doesn't support
		// Stop and Rewind
	}
}

