//--------------------------------
//  Top of Page
//--------------------------------

var message='<a href="#top" onmouseover="window.status=\'to the Top of this Page\';return true;" onmouseout="window.status=\'\';return true;"><img src="images/arrow.gif" width=26 height=30 border=0 alt="to the Top of this Page"></a>'
var ie=document.all
var ieNOTopera=document.all&&navigator.userAgent.indexOf("Opera")==-1

function regenerate(){
  window.location.reload()
}

function regenerate2(){
  if (document.layers)
  setTimeout("window.onresize=regenerate",400)
}

if (ie||document.getElementById)
  document.write('<div id="topmsg" style="position:absolute;visibility:hidden">'+message+'</div>')

var topmsg_obj=ie? document.all.topmsg : document.getElementById? document.getElementById("topmsg") : document.topmsg

function positionit(){
  var dsocleft=ie? document.body.scrollLeft : pageXOffset
  var dsoctop=ie? document.body.scrollTop : pageYOffset
  var window_width=ieNOTopera? document.body.clientWidth : window.innerWidth-20
  var window_height=ieNOTopera? document.body.clientHeight : window.innerHeight

  if (ie||document.getElementById){
    topmsg_obj.style.left=parseInt(dsocleft)+window_width-topmsg_obj.offsetWidth-10
    topmsg_obj.style.top=parseInt(dsoctop)+parseInt(window_height)-topmsg_obj.offsetHeight-10
  }
  else if (document.layers){
    topmsg_obj.left=dsocleft+window_width-topmsg_obj.document.width-10
    topmsg_obj.top=dsoctop+window_height-topmsg_obj.document.height-10
  }
}

//--------------------------------
//  Countdown
//--------------------------------

function getTime() {
c1 = new Image(); c1.src = "images/clock/1c.gif";
c2 = new Image(); c2.src = "images/clock/2c.gif";
c3 = new Image(); c3.src = "images/clock/3c.gif";
c4 = new Image(); c4.src = "images/clock/4c.gif";
c5 = new Image(); c5.src = "images/clock/5c.gif";
c6 = new Image(); c6.src = "images/clock/6c.gif";
c7 = new Image(); c7.src = "images/clock/7c.gif";
c8 = new Image(); c8.src = "images/clock/8c.gif";
c9 = new Image(); c9.src = "images/clock/9c.gif";
c0 = new Image(); c0.src = "images/clock/0c.gif";
Cc = new Image(); Cc.src = "images/clock/cc.gif";

Target_Date = Date.UTC(2010,7,5,10,0,0);   //server(GMT) == 5 August 2010
//Target_Date = new Date(2010,7,5,17,0,0); //local (WIB) == 5 August 2010
date__Local = new Date();
Todays_Date = date__Local.getTime();

if (Target_Date - Todays_Date < 0) {
	Target_Date = Todays_Date;
}
Time_Left = (Target_Date - Todays_Date);
days = Time_Left / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = Time_Left / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = Time_Left / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
seconds = Time_Left / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.round(seconds);

if (secondsRound <= 9) {
document.images.g.src = c0.src;
document.images.h.src = eval("c"+secondsRound+".src");
}
else {
document.images.g.src = eval("c"+Math.floor(secondsRound/10)+".src");
document.images.h.src = eval("c"+(secondsRound%10)+".src");
}
if (minutesRound <= 9) {
document.images.d.src = c0.src;
document.images.e.src = eval("c"+minutesRound+".src");
}
else {
document.images.d.src = eval("c"+Math.floor(minutesRound/10)+".src");
document.images.e.src = eval("c"+(minutesRound%10)+".src");
}
if (hoursRound <= 9) {
document.images.y.src = c0.src;
document.images.z.src = eval("c"+hoursRound+".src");
}
else {
document.images.y.src = eval("c"+Math.floor(hoursRound/10)+".src");
document.images.z.src = eval("c"+(hoursRound%10)+".src");
}
if (daysRound <= 9) {
document.images.x.src = c0.src;
document.images.a.src = c0.src;
document.images.b.src = eval("c"+daysRound+".src");
}
if (daysRound <= 99) {
document.images.x.src = c0.src;
document.images.a.src = eval("c"+Math.floor((daysRound/10)%10)+".src");
document.images.b.src = eval("c"+Math.floor(daysRound%10)+".src");
}
if (daysRound <= 999){
document.images.x.src = eval("c"+Math.floor(daysRound/100)+".src");
document.images.a.src = eval("c"+Math.floor((daysRound/10)%10)+".src");
document.images.b.src = eval("c"+Math.floor(daysRound%10)+".src");
}
newtime = window.setTimeout("getTime();", 1000);

  if (document.layers){
    topmsg_obj=new Layer(window.innerWidth)
    regenerate2()
    topmsg_obj.document.write(message)
    topmsg_obj.document.close()
    positionit()
    topmsg_obj.visibility="show"
  }
  else{
    positionit()
    topmsg_obj.style.visibility="visible"
  }
  setInterval("positionit()",100)

}

//--------------------------------
//  Hari dan Tanggal
//--------------------------------

function MakeArray(n) {
  this.length = n
  return this
}

monthNames = new MakeArray(12)
monthNames[1] = "January"
monthNames[2] = "February"
monthNames[3] = "March"
monthNames[4] = "April"
monthNames[5] = "May"
monthNames[6] = "June"
monthNames[7] = "July"
monthNames[8] = "August"
monthNames[9] = "September"
monthNames[10] = "October"
monthNames[11] = "November"
monthNames[12] = "December"
dayNames = new MakeArray(7)
dayNames[1] = "Sunday"
dayNames[2] = "Monday"
dayNames[3] = "Tuesday"
dayNames[4] = "Wednesday"
dayNames[5] = "Thursday"
dayNames[6] = "Friday"
dayNames[7] = "Saturday"

function customDateString() {
  currentDate = new Date()
  var theDay = dayNames[currentDate.getDay() + 1]
  var theMonth = monthNames[currentDate.getMonth() + 1]
  msie4 = ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 ));
  if (msie4) {
    var theYear = currentDate.getYear()
  }
  else {
    var theYear = currentDate.getYear()
  }
  return theDay + ", &nbsp;" + currentDate.getDate() + " &nbsp;" + theMonth + " &nbsp;" + theYear
}

//--------------------------------
//  Menu Image Ganti onMouse Klik Auction
//--------------------------------

aA1=new Image(165,25)
aA1.src="img/aucA_1.jpg"
aB1=new Image(165,25)
aB1.src="img/aucB_1.jpg"
aA2=new Image(165,25)
aA2.src="img/aucA_2.jpg"
aB2=new Image(165,25)
aB2.src="img/aucB_2.jpg"
aA3=new Image(165,25)
aA3.src="img/aucA_3.jpg"
aB3=new Image(165,25)
aB3.src="img/aucB_3.jpg"
aA4=new Image(165,25)
aA4.src="img/aucA_4.jpg"
aB4=new Image(165,25)
aB4.src="img/aucB_4.jpg"
aA5=new Image(165,25)
aA5.src="img/aucA_5.jpg"
aB5=new Image(165,25)
aB5.src="img/aucB_5.jpg"
aA6=new Image(165,25)
aA6.src="img/aucA_6.jpg"
aB6=new Image(165,25)
aB6.src="img/aucB_6.jpg"
aA7=new Image(165,25)
aA7.src="img/aucA_7.jpg"
aB7=new Image(165,25)
aB7.src="img/aucB_7.jpg"
aA8=new Image(165,25)
aA8.src="img/aucA_8.jpg"
aB8=new Image(165,25)
aB8.src="img/aucB_8.jpg"

function filter(imagename,objectsrc){
if (document.images)
document.images[imagename].src=eval(objectsrc+".src")
}

//--------------------------------
//  Category Item Lot
//--------------------------------

function loadPage(list) {
  location.href=list.options[list.selectedIndex].value
}


//--------------------------------
//  Print This Page
//--------------------------------

function reload() {
	var val1=document.passinq.user.value ;
	var val2=document.passinq.city.value ;
	var val3=document.passinq.email.value ;
	var val4=document.passinq.hint.value ;

///	for(var i=0; i < document.form1.type.length; i++) {
///		if(document.form1.type[i].checked)
///		var val4=document.form1.type[i].value 
///	}

	self.location='passid.php?user=' + val1 + '&city=' + val2 + '&email=' + val3 + '&hint=' + val4;
}

//--------------------------------
//  Print This Page
//--------------------------------

function printWindow(){
   bV = parseInt(navigator.appVersion)
   if (bV >= 4) window.print()
}

//--------------------------------
//  Tampilkan Gambar
//--------------------------------

PositionX = 100;
PositionY = 100;
defaultWidth  = 500;
defaultHeight = 500;
var AutoClose = true;
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
writeln('<sc'+'ript>');
writeln('var isNN,isIE;');
writeln('var message = "MESSAGE GOES HERE";');
writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');
writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');
writeln('if (isIE){');
writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');
writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');
writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');
writeln('</sc'+'ript>');
writeln('<sc'+'ript language="Javascript1.2">');
writeln('am = "This function is disabled!";');
writeln('bV  = parseInt(navigator.appVersion)');
writeln('bNS = navigator.appName=="Netscape"');
writeln('bIE = navigator.appName=="Microsoft Internet Explorer"');
writeln('function nrc(e) {');
writeln('if (bNS && e.which > 1){');
writeln('alert(am)');
writeln('return false');
writeln('} else if (bIE && (event.button >1)) {');
writeln('alert(am)');
writeln('return false;');
writeln('}');
writeln('}');
writeln('document.onmousedown = nrc;');
writeln('if (document.layers) window.captureEvents(Event.MOUSEDOWN);');
writeln('if (bNS && bV<5) window.onmousedown = nrc;');
writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor="#000000" scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();		
}}
