var time_to_load = 0;
function time_load() {
	time_to_load++;
}
load_page=setInterval ( 'time_load()', 1000 );

// Drop-in content box- By Dynamic Drive
// For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
// This credit MUST stay intact for use

var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var calunits=document.layers? "" : "px"

var bouncelimit=32 //(must be divisible by 8)
var direction="up"

function initbox(){
if (!dom&&!ie&&!ns4)
return
dropbegin=setInterval("begindrop()",5000)
}

function begindrop(){
clearInterval(dropbegin);	
crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
crossobj.top=scroll_top-300+calunits
crossobj.visibility=(dom||ie)? "visible" : "show"
dropstart=setInterval("dropin()",50)
document.cookie="droppedin=yes"
}

function dropin(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossobj.top)<20+scroll_top)
crossobj.top=parseInt(crossobj.top)+40+calunits
else{
clearInterval(dropstart)
bouncestart=setInterval("bouncein()",50)
}
}

function bouncein(){
crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
if (bouncelimit<0)
bouncelimit+=8
bouncelimit=bouncelimit*-1
if (bouncelimit==0){
clearInterval(bouncestart)
}
}

function dismissbox(){
if (window.bouncestart) clearInterval(bouncestart)
crossobj.visibility="hidden"
crossobj.top=-800;
}

function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}


function get_cookie(Name) {
var search = Name + "="
var returnvalue = ""
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset)
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function dropornot(){
if (get_cookie("droppedin")==""){
window.onload=initbox

}
}
//window.onload=initbox;
dropornot()


function playvid(url,x1,y1) {
	if((typeof x1)=='undefined') {
		x1='';
	}
	if((typeof y1)=='undefined') {
		y1='';
	}
	window.open('/video.php?vid='+url+'&x1='+x1+'&y1='+y1+'','vidwin','width='+x1+',height='+y1+'');
}
function playutubevid(url) {
	window.open(url,"vidwin","width=425,height=344");
}

var phponline = 0;
var path = location.pathname.substring(1,6);
if ((location.hostname != "babelfish.yahoo.com")&&(location.protocol == "http:")&&(path != "barry")&&(path != "babel")) {
	if (top.window.document.title != "Altered States *") {
		top.window.location.replace("/index2.htm?"+location.pathname+location.search);
	}
}
var loc_ok = 1;
/*var origin ="";
var nzadjust = 1;	  
var usadjust =.70407;
var usa =0.70569998;*/
var curcode="NZ $ ";
var WGdc=".";
function FormatMoney(A) {
/*if (origin !="nz") {adjust=usadjust;} else {adjust=nzadjust;}
	A=A*adjust;*/
  var N=Math.abs(Math.round(A*100));
  var S=((N<10)?"00":((N<100)?"0":""))+N;
  S=(S.substring(0,(S.length-2)))+WGdc+
    S.substring((S.length-2),S.length);
  return (S.length>14)?"over":S;
}
function convert(price) {
 amount = price;
 if ((location.hostname != "babelfish.yahoo.com")&&(location.protocol == "http:")&&(path != "barry")&&(path != "babel")) {
	parent.curconvt.amount = price;
	}
       var currency = window.open('/currenc2.htm','convert','toolbar=no,scrollbars=yes,width=740,height=520');
      return;
}
function music_off() {
	self.parent.window.control.music_state = 1;
	self.parent.window.music.document.location = "/randmidi.htm";
}
document.writeln('<link rel="shortcut icon" href="/favicon.ico">');
document.writeln("<STYLE>  A:hover {color:red;background-color:#4bc4f1;}");
document.writeln(".button {font-size : 10px;color : yellow;font-weight : bold;background-color : #1A00FF; }");
document.writeln(".hilite {color: #FF0000; background-color:#FFFF00; }");
document.writeln("#loading {width: 100px;height: 100px;background-color: #FFFFFF;position: absolute;left: 100px;top: 100px;margin-top: -50px;margin-left: -50px;text-align: center; }");
document.writeln("</STYLE>");

/*document.write('<script language="JavaScript1.2" src= "http://www.altered-states.net/phplive/check.php"></script>');*/
  
document.write('<div id="loading"><img src="/anibcir.gif"></div>');

var on_page = null;
var imagnum = 0;
function stillthere(){
if(document.all.time_image) {
imagnum++; /* time equals imagnum *20 secs*/
/*clearTimeout(on_page);*/
time_image.src='/php/pagetimer.php?timer='+imagnum+'&loadtime='+time_to_load+'&page=AM_'+location.pathname;
}

}
// on_page=setInterval ( 'stillthere()', 20000 );


// Created by: Simon Willison | http://simon.incutio.com/
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(function() {
  document.getElementById("loading").style.display="none";
  clearInterval(load_page);
});
