/*
	Old School Javascript
*/

var IMAGE_path = "http://philippinetravelstories.philippinehotelreservations.com/wp-content/themes/travelstories/.gfx/.index/slides/";
var IMAGES     = Array();
var cnt        = 0;
var sto        = "";
var sto_pi     = "";
var occlusion  = Array(0,0.0); 

	 IMAGES[0] = new Image();
	 IMAGES[1] = new Image();
	 IMAGES[2] = new Image();
	 
	 IMAGES[0].src = IMAGE_path + "1.jpg";
	 IMAGES[1].src = IMAGE_path + "2.jpg";
	 IMAGES[2].src = IMAGE_path + "3.jpg";

function setOpacity() {
	if(occlusion[0] <= 100 && occlusion[1] <= 1) {
		document.getElementById("img_slide").style.filter  = "alpha(opacity="+ occlusion[0] +")";
		document.getElementById("img_slide").style.opacity = occlusion[1];
		occlusion[0] += 5;
		occlusion[1] += .05;
		sto = setTimeout("setOpacity()", 50);
	} else {
		occlusion[0]  = 0;
		occlusion[1]  = 0.0;
		clearTimeout(sto);
	}
}

function previewImages() {
	if(IMAGES[cnt] == IMAGES[0]) {	disp  = "<a href='http://philippinetravelstories.philippinehotelreservations.com/?page_id=4'>"; }
	if(IMAGES[cnt] == IMAGES[1]){	disp  = "<a href='http://philippinetravelstories.philippinehotelreservations.com/?p=507'>"; }
	if(IMAGES[cnt] == IMAGES[2]) {	disp  = "<a href='http://philippinetravelstories.philippinehotelreservations.com/?p=523'>"; }
	disp += "<image id='img_slide' src='"+ IMAGES[cnt].src +"' width='380' height='230' />";
	disp += "</a>";
	document.getElementById("spn_images").innerHTML = disp;
	setOpacity();
	
	cnt++;
	if(cnt == IMAGES.length) {
		cnt = 0;	
	}
	sto_pi = setTimeout("previewImages()", 9000);
}

function setCnt(cnt_val) {
	clearTimeout(sto);
	clearTimeout(sto_pi);
	
	if(cnt_val != 9999)
		cnt = cnt_val;
}



