function Marquee(marquee_text, marquee_textcolor, marquee_textlinkcolor, marquee_fonttype, marquee_speed, marquee_bgcolor, link, statusBarText) {
  document.write('<applet code="iscroll.class" codebase="../classes" width="980" height="18"><param name="Notice" value="Applet by www.CodeBrain.com" > <param name="Text" value="' + marquee_text + '" > <param name="TextColor" value="' + marquee_textcolor + '" > <param name="TextLinkColor" value="' + marquee_textlinkcolor + '" > <param name="VerticalBias" value="0" > <param name="FontName" value="' + marquee_fonttype + '" > <param name="FontStyle" value="0" > <param name="Speed" value="' + marquee_speed + '" > <param name="Pause" value="0" > <param name="BackgroundColor" value="' + marquee_bgcolor + '" > <param name="MouseMode" value="1" > <param name="StatusBarText" value="' + statusBarText + '" >  Please use a Java-enabled browser to see the scrolling marquee. </applet>');
}

function OpenMapWindow() {
  // calculate centering co-ordinates
  xpos=(window.screen.width-720)/2;
  ypos=(window.screen.height-500)/2;

  window.open("../locationinfo/malllocationmap.ch2","Map","target=new,width=820,height=500,left=" + xpos + ",top=" + ypos + ",scrollbars=yes,menubar=no,toolbar=no,resizeable=no");
}

function changePromoView(sortField, sortOrder) {
  document.search.sortField.value = sortField;
  document.search.sortOrder.value = sortOrder;
  document.search.submit();
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
function changeImagesArray(array) {
    if (preloadFlag == true) {
        var d = document; var img;
        for (var i=0; i<array.length; i+=2) {
            img = null; var n = array[i];
            if (d.images) {img = d.images[n];}
            if (!img && d.getElementById) {img = d.getElementById(n);}
            if (img) {img.src = array[i+1];}
        }
    }
}
function openlocationwindow(wwwaddress,wd,ht)
{
  window.open(wwwaddress,'MallLocationMap','width=' + wd + ',height=' + ht + ',status=no,toolbar=no,menubar=no,resizable=yes,scrollbars=yes');
}
function changeto(form)
{
	var myindex=form.dropdown.selectedIndex;
	if (form.dropdown.options[myindex].value != "0") {
	location=form.dropdown.options[myindex].value;}
}

function changeImages() {
	changeImagesArray(changeImages.arguments);
}

var preloadFlag = false;
function preloadImages() {
if (document.images) {
  pre_navstoreh = newImage('image/navstoreh.gif');
  pre_navoptionalh = newImage('image/navoptionalh.gif');
  pre_navcontacth = newImage('image/navcontacth.gif');
  pre_navlocateh = newImage('image/navlocateh.gif');
  //pre_navnewsletterh = newImage('image/navnewsletterh.gif');
  pre_navjobpostingh = newImage('image/navjobpostingh.gif');
  preloadFlag = true;
}
}

function openCouponWin(winname, image) {
  xpos=(window.screen.width-720)/2;
  ypos=(window.screen.height-500)/2;

  if(winname=='')
    winname='couponwin';

  var oWin = window.open("coupon.ch2?img=" + image,winname,"target=new,width=720,height=400,left=" + xpos + ",top=" + ypos + ",scrollbars=yes,menubar=no,toolbar=no,resizeable=yes");

  oWin.focus();
  return;
}

// Gets the dimensions of the user's window for many different browsers--
// Returns an array of pageWidth, pageHeight, windowWidth, and windowHeight
// By Lokesh Dhakar of http://www.huddletogether.com
function getPageSize()
{
var xScroll, yScroll;

if (window.innerHeight && window.scrollMaxY)
{
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
}
else if (document.body.scrollHeight > document.body.offsetHeight)
// all but Explorer Mac
{
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
}
else
// Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
{
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}

var windowWidth, windowHeight;

if (self.innerHeight)
// all except Explorer
{
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight)
// Explorer 6 Strict Mode
{
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
}
else if (document.body)
// other Explorers
{
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}

// for small pages with total height less then height of the viewport
if (yScroll < windowHeight)
pageHeight = windowHeight;
else
pageHeight = yScroll;

// for small pages with total width less then width of the viewport
if (xScroll < windowWidth)
pageWidth = windowWidth;
else
pageWidth = xScroll;

arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;
}

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function Set_Cookie( name, value, expires, path, domain, secure ) {
    // set time, it's in milliseconds
    var today = new Date();
    today.setTime( today.getTime() );

    /*
    if the expires variable is set, make the correct
    expires time, the current script below will set
    it for x number of days, to make it for hours,
    delete * 24, for minutes, delete * 60 * 24
    */
    if ( expires ){
        expires = expires * 1000 * 60 * 60 * 24;
    }

    var expires_date = new Date( today.getTime() + (expires) );

    document.cookie = name + "=" +escape( value ) +
    ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
    ( ( path ) ? ";path=" + path : "" ) +
    ( ( domain ) ? ";domain=" + domain : "" ) +
    ( ( secure ) ? ";secure" : "" );
}

//Set_Cookie('hideprizedraw', '', 0, '/', '', '' );

function closePrizeDraw(){
  if (document.getElementById('donotshow').checked == true) {
    Set_Cookie('hideprizedraw', 'true', 120, '/', '', '' );
  }
  opacity('overlay2', 92, 0, 750);
  setTimeout(function(){document.getElementById('overlay2').style.display = 'none'}, 700);
}

function buildPopOver() {
  var pageSize = getPageSize();
  var pageModalMask = document.createElement('div');
  var pageModal = document.createElement('div');

  pageModalMask.style.position = 'absolute';
  pageModalMask.style.display = 'block';
  pageModalMask.style.visibility = 'visible';
  pageModalMask.style.top = '0px';
  pageModalMask.style.left = '0px';
  pageModalMask.style.width = pageSize[0] + 'px';
  pageModalMask.style.height = pageSize[1] + 'px';
  pageModalMask.className = 'pageModalMask';

  pageModal.style.width = '500px';
  pageModal.style.height = '300px';
  pageModal.style.top = '200px';
  pageModal.style.left = ((pageSize[0] - 556) / 2) + 'px';
  pageModal.className = 'pageModal';
  pageModal.innerHTML = '<a href="http://www.e-space.com">E-Space</a>';

  document.body.appendChild(pageModalMask);
  document.body.appendChild(pageModal);
}