﻿var interval = 5; // delay between rotating images (in seconds)
var random_display = 0; // 0 = no, 1 = yes
interval *= 1000;

var innerHTML_index = 0;
innerHTML_list = new Array();
//innerHTML_list[innerHTML_index++] = '<a align="center" style="font-size:34pt; font-weight:bold; text-decoration:none;" href="12%202010%20Calendar.asp"><img border="0" src="img_yd/adv_calendar.bmp"style="vertical-align:middle; position:relative;" /></a>';
innerHTML_list[innerHTML_index++] = '<a align="center" style="font-size:42pt; font-weight:bold; text-decoration:none;" href="http://www.greenbag.com.hk/" target="_blank"><img border="0" width="370" height="175" src="img_yd/toprightbanner/greenbagmanufactory.jpg" style="vertical-align:middle; position:relative; top:10px; padding:0px 0px;" /></a>';
innerHTML_list[innerHTML_index++] = '<a align="center" style="font-size:42pt; font-weight:bold; text-decoration:none;" href="29Banner.asp" target="_blank"><img border="0" width="370" height="175" src="img_yd/toprightbanner/banner.jpg" style="vertical-align:middle; position:relative; top:10px; padding:0px 0px;" /></a>';
innerHTML_list[innerHTML_index++] = '<a align="center" style="font-size:42pt; font-weight:bold; text-decoration:none;" href="06Booklet.asp" target="_blank"><img border="0" width="370" height="175" src="img_yd/toprightbanner/booklet.jpg" style="vertical-align:middle; position:relative; top:10px; padding:0px 0px;" /></a>';
innerHTML_list[innerHTML_index++] = '<a align="center" style="font-size:42pt; font-weight:bold; text-decoration:none;" href="31Chopstickssets.asp" target="_blank"><img border="0" width="370" height="175" src="img_yd/toprightbanner/chopstick.jpg" style="vertical-align:middle; position:relative; top:10px; padding:0px 0px;" /></a>';
innerHTML_list[innerHTML_index++] = '<a align="center" style="font-size:42pt; font-weight:bold; text-decoration:none;" href="24Paper%20Box.asp" target="_blank"><img border="0" width="370" height="175" src="img_yd/toprightbanner/colored_paper_box.jpg" style="vertical-align:middle; position:relative; top:10px; padding:0px 0px;" /></a>';
innerHTML_list[innerHTML_index++] = '<a align="center" style="font-size:42pt; font-weight:bold; text-decoration:none;" href="30DeskCalendar.asp" target="_blank"><img border="0" width="370" height="175" src="img_yd/toprightbanner/desk_calendar.jpg" style="vertical-align:middle; position:relative; top:10px; padding:0px 0px;" /></a>';
innerHTML_list[innerHTML_index++] = '<a align="center" style="font-size:42pt; font-weight:bold; text-decoration:none;" href="09Label.asp" target="_blank"><img border="0" width="370" height="175" src="img_yd/toprightbanner/label.jpg" style="vertical-align:middle; position:relative; top:10px; padding:0px 0px;" /></a>';
innerHTML_list[innerHTML_index++] = '<a align="center" style="font-size:42pt; font-weight:bold; text-decoration:none;" href="07Leaflet.asp" target="_blank"><img border="0" width="370" height="175" src="img_yd/toprightbanner/leaflet.jpg" style="vertical-align:middle; position:relative; top:10px; padding:0px 0px;" /></a>';
innerHTML_list[innerHTML_index++] = '<a align="center" style="font-size:42pt; font-weight:bold; text-decoration:none;" href="25MemoPad.asp" target="_blank"><img border="0" width="370" height="175" src="img_yd/toprightbanner/memo.jpg" style="vertical-align:middle; position:relative; top:10px; padding:0px 0px;" /></a>';
innerHTML_list[innerHTML_index++] = '<a align="center" style="font-size:42pt; font-weight:bold; text-decoration:none;" href="11Paper%20Bag.asp" target="_blank"><img border="0" width="370" height="175" src="img_yd/toprightbanner/paper_bag.jpg" style="vertical-align:middle; position:relative; top:10px; padding:0px 0px;" /></a>';
innerHTML_list[innerHTML_index++] = '<a align="center" style="font-size:42pt; font-weight:bold; text-decoration:none;" href="33Paperfan.asp" target="_blank"><img border="0" width="370" height="175" src="img_yd/toprightbanner/paper_fan.jpg" style="vertical-align:middle; position:relative; top:10px; padding:0px 0px;" /></a>';
innerHTML_list[innerHTML_index++] = '<a align="center" style="font-size:42pt; font-weight:bold; text-decoration:none;" href="14Ball%20pen.asp" target="_blank"><img border="0" width="370" height="175" src="img_yd/toprightbanner/promotion_pen.jpg" style="vertical-align:middle; position:relative; top:10px; padding:0px 0px;" /></a>';
innerHTML_list[innerHTML_index++] = '<a align="center" style="font-size:42pt; font-weight:bold; text-decoration:none;" href="02VIPCard.asp" target="_blank"><img border="0" width="370" height="175" src="img_yd/toprightbanner/pvc_card.jpg" style="vertical-align:middle; position:relative; top:10px; padding:0px 0px;" /></a>';
innerHTML_list[innerHTML_index++] = '<a align="center" style="font-size:42pt; font-weight:bold; text-decoration:none;" href="19Red%20Pocket.asp" target="_blank"><img border="0" width="370" height="175" src="img_yd/toprightbanner/red_pocket.jpg" style="vertical-align:middle; position:relative; top:10px; padding:0px 0px;" /></a>';
innerHTML_list[innerHTML_index++] = '<a align="center" style="font-size:42pt; font-weight:bold; text-decoration:none;" href="08Weddy%20Card.asp" target="_blank"><img border="0" width="370" height="175" src="img_yd/toprightbanner/wedding_card.jpg" style="vertical-align:middle; position:relative; top:10px; padding:0px 0px;" /></a>';
//innerHTML_list[innerHTML_index++] = '<a align="center" style="font-size:42pt; font-weight:bold; text-decoration:none;" href="01Card_special_offer.asp" target="_blank"><img border="0" src="img_yd/promotion_card.JPG" style="vertical-align:middle; position:relative;" /></a>';
//innerHTML_list[innerHTML_index++] = '<a align="center" style="font-size:42pt; font-weight:bold; text-decoration:none;"><img border="0" src="img_yd/stationerylogo.bmp" style="vertical-align:middle; position:relative;" /></a>';

var style_index = 0;
style_bgColor_list = new Array();
//style_bgColor_list[style_index++] = '#CC0000';
style_bgColor_list[style_index++] = '#FFFFFF';
style_bgColor_list[style_index++] = '#FFFFFF';
style_bgColor_list[style_index++] = '#FFFFFF';
style_bgColor_list[style_index++] = '#FFFFFF';
style_bgColor_list[style_index++] = '#FFFFFF';
style_bgColor_list[style_index++] = '#FFFFFF';
style_bgColor_list[style_index++] = '#FFFFFF';
style_bgColor_list[style_index++] = '#FFFFFF';
style_bgColor_list[style_index++] = '#FFFFFF';
style_bgColor_list[style_index++] = '#FFFFFF';
style_bgColor_list[style_index++] = '#FFFFFF';
style_bgColor_list[style_index++] = '#FFFFFF';
style_bgColor_list[style_index++] = '#FFFFFF';
style_bgColor_list[style_index++] = '#FFFFFF';
style_bgColor_list[style_index++] = '#FFFFFF';
//style_bgColor_list[style_index++] = '#A9DDFF';

var short_description_index = 0;
short_description = new Array();
short_description[short_description_index++] = '&nbsp;';
short_description[short_description_index++] = '&nbsp;';
short_description[short_description_index++] = '&nbsp;';
short_description[short_description_index++] = '&nbsp;';
short_description[short_description_index++] = '&nbsp;';
short_description[short_description_index++] = '&nbsp;';
short_description[short_description_index++] = '&nbsp;';
short_description[short_description_index++] = '&nbsp;';
short_description[short_description_index++] = '&nbsp;';
short_description[short_description_index++] = '&nbsp;';
short_description[short_description_index++] = '&nbsp;';
short_description[short_description_index++] = '&nbsp;';
short_description[short_description_index++] = '&nbsp;';
short_description[short_description_index++] = '&nbsp;';
short_description[short_description_index++] = '&nbsp;';
short_description[short_description_index++] = '&nbsp;';
short_description[short_description_index++] = '&nbsp;';

var number_of_image = innerHTML_list.length;

function generate(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}

function rotateImage(place) {
 if (random_display) {
  innerHTML_index = generate(0, number_of_image-1);
 } else {
  innerHTML_index = (innerHTML_index+1) % number_of_image;
 }
 document.getElementById(place).innerHTML = '<table border="0" style="background-color:'+style_bgColor_list[innerHTML_index]+';"><tr height="150px"><td align="center">' + innerHTML_list[innerHTML_index]+'</td></tr><tr height="20px"><td align="right" style="color:#ffffff;font-size:20px">'+short_description[innerHTML_index]+'</td></tr></table>';
 document.getElementById(place).style.backgroundColor = style_bgColor_list[innerHTML_index];
 var recur_call = "rotateImage('"+place+"')";
 setTimeout(recur_call, interval);
}
