/*---------------------------------------------*/
var baseURL = "http://www.puteraco.co.id/"; 
/*---------------------------------------------*/

// INITIALIZE
is = new BrowserCheck();

NS6 = (document.getElementById&&!document.all) ? 1: 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;

// GENERAL UTILITY
function Start(page) {OpenWin = this.open(page, 'CtrlWindow', 'toolbar=yes,menubar=no,location=yes,scrollbars=yes,resizable=yes,width=600, height=300');}
function gotoUrl(){
	args=gotoUrl.arguments; 
	location.href=args[0];
}
function gotoBaseUrl(){	location.href=baseURL;}

// REMOTE WINDOW
function remote(title,iname,w,h)
{
  PreView=window.open("","",
    "width=" + (w+10) + ",height=" + (h+40) + 
    "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0")
  PreView.document.open();
  PreView.document.write("<HTML><HEAD><link rel=stylesheet type=text/css href=puteraco.css><TITLE>");
  PreView.document.write(title);
  PreView.document.write("</TITLE></HEAD><BODY><CENTER><FONT CLASS=f8bb>");
  PreView.document.write(title);
  PreView.document.write("<BR></FONT><IMG HSPACE=0 VSPACE=5 " + "SRC='img/" + iname + "'>");
  PreView.document.write("<br><input class=button type=submit value=' Close ' onclick='window.close()'>");
  PreView.document.write("</font></CENTER></BODY></HTML>");
  PreView.document.close();
}

// MARQUEE
function WriteMarquee(maxmq, mqData){
	var i;
	var t="";
	if(IE){
		t+="<marquee width=150 height=106 direction=up align=center scrollamount=2>";
		for(i=0;i<maxmq;i++){
			t+="<a class=fscroll href=";
			t+=mqData[i][0]; t+=">"; t+=mqData[i][1];
			t+="</a><br><br>";
		}
		t+="</marquee>";
		document.write(t);
	}
	else document.write("&nbsp;");
}

// DATE & CLOCK
function GetDay(intDay){
    var DayArray = new Array("Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu")
    return DayArray[intDay]
}
function GetMonth(intMonth){
    var MonthArray = new Array("Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember") 
    return MonthArray[intMonth] 	  	 
}
function getDateStrWithDOW(){
    var today = new Date()
    var year = today.getYear();if(year<1000) year+=1900
    var todayStr = GetDay(today.getDay()) + ", " + today.getDate() + " " + GetMonth(today.getMonth()) + " " + year
    return todayStr
}

// BROWSER CHECK
function BrowserCheck() {
	var b = navigator.appName;
	if (b == "Netscape") this.b = "NS";
	else if (b == "Microsoft Internet Explorer") this.b = "IE";
	else this.b = b;

	this.v = parseInt(navigator.appVersion);
	this.NS = (this.b == "NS" && this.v>=4);
	this.NS4 = (this.b == "NS" && this.v == 4);
	this.NS5 = (this.b == "NS" && this.v == 5);
	this.IE = (this.b == "IE" && this.v>=4);
	this.IE4 = (navigator.userAgent.indexOf('MSIE 4')>0);
	this.IE5 = (navigator.userAgent.indexOf('MSIE 5')>0);
	if (this.IE5 || this.NS5) this.VER5 = true;
	if (this.IE4 || this.NS4) this.VER4 = true;
	this.OLD = (! this.VER5 && ! this.VER4) ? true : false;
	this.min = (this.NS||this.IE);
}

// MABUR

var brOK=false;
var mie=false;
var aver=parseInt(navigator.appVersion.substring(0,1));
var aname=navigator.appName;

function checkbrOK()
{if(aname.indexOf("Internet Explorer")!=-1)
   {if(aver>=4) brOK=navigator.javaEnabled();
    mie=true;
   }
 if(aname.indexOf("Netscape")!=-1)  
   {if(aver>=4) brOK=navigator.javaEnabled();}
}

var vmin=2;
var vmax=15;
var vr=8;
var timer1;

function Chip(chipname,width,height)
{this.named=chipname;
 this.vx=vmin+vmax*Math.random();
 this.vy=vmin+vmax*Math.random();
 this.w=width;
 this.h=height;
 this.xx=0;
 this.yy=0;
 this.timer1=null;
}

function movechip(chipname)
{
 if(brOK)
  {eval("chip="+chipname);
   if(!mie)
    {pageX=window.pageXOffset;
     pageW=window.innerWidth;
     pageY=window.pageYOffset;
     pageH=window.innerHeight;
    }
   else
    {pageX=window.document.body.scrollLeft;
     pageW=window.document.body.offsetWidth-8;
     pageY=window.document.body.scrollTop;
     pageH=window.document.body.offsetHeight;
    } 

   chip.xx=chip.xx+chip.vx;
   chip.yy=chip.yy+chip.vy;
   
   chip.vx+=vr*(Math.random()-0.5);
   chip.vy+=vr*(Math.random()-0.5);
   if(chip.vx>(vmax+vmin))  chip.vx=(vmax+vmin)*2-chip.vx;
   if(chip.vx<(-vmax-vmin)) chip.vx=(-vmax-vmin)*2-chip.vx;
   if(chip.vy>(vmax+vmin))  chip.vy=(vmax+vmin)*2-chip.vy;
   if(chip.vy<(-vmax-vmin)) chip.vy=(-vmax-vmin)*2-chip.vy;


   if(chip.xx<=pageX)
     {chip.xx=pageX;
      chip.vx=vmin+vmax*Math.random();
     }
   if(chip.xx>=pageX+pageW-chip.w)
     {chip.xx=pageX+pageW-chip.w;
      chip.vx=-vmin-vmax*Math.random();
     }
   if(chip.yy<=pageY)
     {chip.yy=pageY;
      chip.vy=vmin+vmax*Math.random();
     }
   if(chip.yy>=pageY+pageH-chip.h)
     {chip.yy=pageY+pageH-chip.h;
      chip.vy=-vmin-vmax*Math.random();
     }

   if(!mie)
      {eval('document.'+chip.named+'.top ='+chip.yy);
       eval('document.'+chip.named+'.left='+chip.xx);
      } 
   else
      {eval('document.all.'+chip.named+'.style.pixelLeft='+chip.xx);
       eval('document.all.'+chip.named+'.style.pixelTop ='+chip.yy); 
      }
   chip.timer1=setTimeout("movechip('"+chip.named+"')",100);
  }
}


function stopme(chipname)
{if(brOK)
  {
   eval("chip="+chipname);
   if(chip.timer1!=null) {clearTimeout(chip.timer1)}
  }
}
