﻿var strLang = document.location.pathname.toLowerCase();
if(strLang.indexOf("/en/")>0)
  strLang="EN";
else if(strLang.indexOf("/sc/")>0)
  strLang="SC";
else
  strLang="CH";
  
function popup_Coupon(Lang) {
  var option, filetoopen;
    option = "width=530,height=580,left=20,top=20,scrollbars=no, resizable=no";
    
    if(Lang=="EN")
        filetoopen = "jetso399.jpg";
    else
        filetoopen = "jetso399.jpg";
     
    window.open(filetoopen, "Coupon", option)
}

function PopYPSearch() {
    var option, filetoopen;
    var popw = 800;
    var poph = 800;
    var popl = parseInt((screen.availWidth/2) - (popw/2))+15;
    var popt = parseInt((screen.availHeight/2) - (poph/2));
	if(popt>100) popt = 100;
    filetoopen = "popup_ypsearch.aspx"
    option = "width=" + popw + ",height=" + poph + ",left=" + popl + ",top=" + popt + "screenX=" + popl + ",screenY=" + popt +"";
    finwin = window.open(filetoopen, "finwin", option)
}

function popup_Dadolce(Lang) {
  var option, filetoopen;
    option = "width=510,height=560,left=200,top=200,scrollbars=no, resizable=no";
    
    if(Lang=="EN")
        filetoopen = "jetso399.jpg";
    else
        filetoopen = "jetso399.jpg";
     
    window.open(filetoopen, "Dadolce", option)
}

function popupMovieGame(Lang) {
    var option, filetoopen;
    var popw = 550;
    var poph = 550;
    var popl = (screen.width - popw) / 2;
    var popt = (screen.height - poph) / 2;

    option = "width=" + popw + ",height=" + poph + ",left=" + popl + ",top=" + popt + ",scrollbars=yes, resizable=yes";
	if(Lang=="EN")
		filetoopen = "jetso399.jpg";
		//filetoopen = "http://test.yp.com.hk/e09_movie_ticket/en/html/iwant_intro.aspx";
	else if(Lang=="CH")
		filetoopen = "jetso399.jpg";
		//filetoopen = "http://test.yp.com.hk/e09_movie_ticket/ch/html/iwant_intro.aspx";
	else
		filetoopen = "jetso399.jpg";
		//filetoopen = "http://gb.yp.com.hk/han3/7/6/9/0/0/0/0/test.yp.com.hk/e09_movie_ticket/sc/html/iwant_intro.aspx";
           
    pGame = window.open(filetoopen, "GameIntro", option);
    pGame.focus();
}    

function popupMovieGameThankYou(Lang) {
	var option, filetoopen;
    var popw = 600;
    var poph = 880;
    var popl = (screen.width - popw) / 2;
    var popt = (screen.height - poph) / 2;

    option = "width=" + popw + ",height=" + poph + ",left=" + popl + ",top=" + popt + ",scrollbars=yes, resizable=yes";
	if(Lang=="EN")
		filetoopen = "jetso399.jpg";
		//filetoopen = "http://test.yp.com.hk/e09_movie_ticket/en/html/thankyou.html";
	else if(Lang=="CH")
		filetoopen = "jetso399.jpg";
		//filetoopen = "http://test.yp.com.hk/e09_movie_ticket/ch/html/thankyou.html";
	else
		filetoopen = "jetso399.jpg";
		//filetoopen = "http://gb.yp.com.hk/han3/7/6/9/0/0/0/0/test.yp.com.hk/e09_movie_ticket/sc/html/thankyou.html";
           
        pGame = window.open(filetoopen, "ThankYou", option);
        pGame.focus();
}

var todayDate = new Date();
var movieStartDate = new Date();
var movieEndDate = new Date();
var movieGameThankyou_Startdate = new Date();
var movieGameThankyou_Enddate = new Date();

movieStartDate.setFullYear(2009,10,13);
movieStartDate.setHours(8);
movieStartDate.setMinutes(0);
movieStartDate.setSeconds(0);
movieStartDate.setMilliseconds(0);

movieEndDate.setFullYear(2009,11,10);
movieEndDate.setHours(23);
movieEndDate.setMinutes(59);
movieEndDate.setSeconds(59);
movieEndDate.setMilliseconds(999);

movieGameThankyou_Startdate.setFullYear(2009,11,11);
movieGameThankyou_Startdate.setHours(0);
movieGameThankyou_Startdate.setMinutes(0);
movieGameThankyou_Startdate.setSeconds(0);
movieGameThankyou_Startdate.setMilliseconds(0);

movieGameThankyou_Enddate.setFullYear(2009,11,17);
movieGameThankyou_Enddate.setHours(23);
movieGameThankyou_Enddate.setMinutes(59);
movieGameThankyou_Enddate.setSeconds(59);
movieGameThankyou_Enddate.setMilliseconds(999);

if (todayDate.getTime()>=movieStartDate.getTime() && todayDate.getTime()<=movieEndDate.getTime()) {
	popupMovieGame(strLang);
}

if (todayDate.getTime()>=movieGameThankyou_Startdate.getTime() && todayDate.getTime()<=movieGameThankyou_Enddate.getTime()) {
	popupMovieGameThankYou(strLang);
}