/**************** MAIN MENU *********************/
//Contents for menu 1
var menu_schedule=new Array()
menu_schedule[0]='<a href="../en/schedule.php?location=0100">Paris van Java</a>'
menu_schedule[1]='<a href="../en/schedule.php?location=0200">Grand Indonesia</a>'
menu_schedule[2]='<a href="../en/schedule.php?location=0300">Pacific Place</a>'
menu_schedule[3]='<a href="../en/schedule.php?location=0400">Mall of Indonesia</a>'
menu_schedule[4]='<a href="../en/schedule.php?location=0500">Teraskota</a>'
menu_schedule[5]='<a href="../en/schedule.php?location=0600">Central Park</a>'
menu_schedule[6]='<a href="../en/schedule.php?location=0700">Bekasi Cyber Park</a>'
menu_schedule[7]='<a href="../en/schedule_class_diningcinema.php">Dining Cinema Class</a>'
menu_schedule[8]='<a href="../en/schedule_class_velvet.php">Velvet Class</a>'
menu_schedule[9]='<a href="../en/schedule_class_satin.php">Satin Class</a>'
menu_schedule[10]='<a href="../en/schedule_3d_cinema.php">3D Cinema</a>'
menu_schedule[11]='<a href="../en/schedule_today.php">All Movies</a>'
menu_schedule[12]='<a href="../en/schedule_comingsoon.php">Coming Soon</a>'

//Contents for menu 2, and so on
var menu_promo=new Array()
menu_promo[0]='<a href="../en/events.php">Events Calendar</a>'
menu_promo[1]='<a href="../en/promo.php">Promo Listing</a>'
menu_promo[2]='<a href="../quiz/index.php">Quiz</a>'

var menu_card=new Array()
menu_card[0]='<a href="../blitzcard/login.php">Your Blitzcard</a>'
//menu_card[1]='<a href="../blitzcard/account.php?act=register">Register</a>'
menu_card[1]='<a href="../blitzcard/about.php">About BlitzCard Regular</a>'
menu_card[2]='<a href="../blitzcard/aboutgold.php">About BlitzCard Gold</a>'
menu_card[3]='<a href="../blitzcard/redeemable_products.php">Redeemable Products</a>'

var menu_news=new Array()
menu_news[0]='<a href="../en/news.php?pg=0">Latest News</a>'
menu_news[1]='<a href="../en/subscribe.php">Newsletter</a>'
menu_news[2]='<a href="../en/blitz_rss.php">Subscribe RSS</a>'

var menu_about=new Array()
menu_about[0]='<a href="../en/about_blitz.php">About Blitz</a>'
menu_about[1]='<a href="../en/contact_blitz.php">Contact Blitz</a>'
menu_about[2]='<a href="../en/join_blitz.php">Join Blitz</a>'

var menu_store=new Array()
menu_store[0]='<a href="http://www.blitzshoppe.com">BlitzShoppe</a>'
menu_store[1]='<a href="#">DigitalBeat Store</a>'

var menuwidth='165px' //default menu width
var menubgcolor='lightyellow'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
  obj.visibility=visible;
} else if (e.type=="click"){
  obj.visibility=hidden;
}
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)

dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
showhideselect(menucontents);
}

return clickreturnvalue()
}

function showhideselect(init){
  if(document.getElementById("select_movie") != null){
    var obj =  document.getElementById("select_movie");
    if(init==menu_schedule){
      obj.style.visibility="hidden";
    } else {
      obj.style.visibility="visible";
    }
  }
}


function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
showhideselect(0);
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu;
/*********************************************/


/*** Others ***/
function do_jump_location(obj){
  var locvalue = obj.options[obj.selectedIndex].value;
  var page = '../en/schedule.php?location=' + locvalue;
  //alert(page);
  window.location.href = page;
}

function do_jump_movie_schedule(obj){
  var pagevalue = obj.options[obj.selectedIndex].value;
  //alert(pagevalue);
  var page = '../en/schedule_movie.php?id=' + pagevalue;
  window.location.href = page;
}

function do_jump_movie_by_date(location, obj, theclass){
  var pagevalue = obj.options[obj.selectedIndex].value;
  var page = '../en/schedule.php?location=' + location + '&date=' + pagevalue;

  if(theclass=='satin'){
    page = '../en/schedule_class_satin.php?date=' + pagevalue;
		//alert(page);
  }
  if(theclass=='velvet'){
    page = '../en/schedule_class_velvet.php?date=' + pagevalue;
  }
  if(theclass=='dining'){
    page = '../en/schedule_class_diningcinema.php?date=' + pagevalue;
  }
	 if(theclass=='3dcinema'){
    page = '../en/schedule_3d_cinema.php?date=' + pagevalue;
  }
  //alert(page);
  window.location.href = page;
}

function do_jump_movie_schedule_by_date(moviecode, obj){
  var pagevalue = obj.options[obj.selectedIndex].value;
  //alert(pagevalue);
  var page = '../en/schedule_movie.php?id=' + moviecode + "&date=" + pagevalue;
  window.location.href = page;
}



/**** POP UP *****/

var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height){

  if(popUpWin){
    if(!popUpWin.closed) popUpWin.close();
  }

  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

var popUpOLPurchase=0;
//var URL_OLPurchase_Page="https://www.blitzmegaplex.com/olbooking/";
var URL_OLPurchase_Page="../olbooking/";
function doShowOnlineBooking(){
  var left = 20;
  var top = 20;
  var width = 800;
  var height = 560;

  if(popUpOLPurchase){
    if(!popUpOLPurchase.closed) popUpOLPurchase.close();
  }
  popUpOLPurchase = open(URL_OLPurchase_Page, 'popUpOLPurchase', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

}

function doShowOnlineBookingWithVal(moviecode, location, date, time, isvip){
  URL_OLPurchase_Page = "../olbooking/default.asp?moviecode="
    + moviecode + "&location=" + location + "&date=" + date + "&time=" + time + "&isvip=" + isvip;
  doShowOnlineBooking();
}

function doSetCookie(c_name,value){
  //alert(c_name + " " + value);
  var exdate=new Date();
  //exdate.setDate(exdate.getDate()+1);
  document.cookie=c_name+ "=" +escape(value);
}

function doDeleteCookie(c_name) {
  path = "";
  domain = "";
  if ( doReadCookie( name ) ) document.cookie = name + "=" +
  ( ( path ) ? ";path=" + path : "") +
  ( ( domain ) ? ";domain=" + domain : "" ) +
  ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}


function doReadCookie(c_name){
  if (document.cookie.length>0){
    alert(document.cookie);
    c_start=document.cookie.indexOf(c_name + "=");
    //alert(c_name);
    if (c_start!=-1){
      c_start=c_start + c_name.length+1;
      c_end=document.cookie.indexOf(";",c_start);
      if (c_end==-1) c_end=document.cookie.length;
      return unescape(document.cookie.substring(c_start,c_end));
      }
    }
  return "";
}
