//LoongX Looping ver 1.0
//Created by Edison tsai at 23:40 11/11/07 for Looping images
//Powered by LoongX Software
//Link http://www.LoongX.com
var LXrotate_delay = 7000; // delay in milliseconds
LXcurrent_factory = 0;
LXcurrent_machinery = 0;
LXcurrent_warehouse = 0;
var LXNum   = 2;

var LX_pic_path  = 'images/';
var LX_pic_path2  = 'images/';
var LX_thumb_prefix = 'thumbnail_';
var LX_photo_prefix = 'photo_';
var LXLinks = new Array();
var LXPhoto = new Array();
LXLinks[0] = new Array();
LXPhoto[0] = new Array();
LXLinks[1] = new Array();
LXPhoto[1] = new Array();
LXLinks[2] = new Array();
LXPhoto[2] = new Array();
//Pic path
LXLinks[0][0] = LX_pic_path+LX_thumb_prefix+"factory1.gif";
LXLinks[0][1] = LX_pic_path+LX_thumb_prefix+"factory2.gif";
LXLinks[0][2] = LX_pic_path+LX_thumb_prefix+"factory3.gif";
LXLinks[0][3] = LX_pic_path+LX_thumb_prefix+"factory4.gif";

LXLinks[1][0] = LX_pic_path+LX_thumb_prefix+"machinery1.gif";
LXLinks[1][1] = LX_pic_path+LX_thumb_prefix+"machinery2.gif";
LXLinks[1][2] = LX_pic_path+LX_thumb_prefix+"machinery3.gif";
LXLinks[1][3] = LX_pic_path+LX_thumb_prefix+"machinery4.gif";
LXLinks[1][4] = LX_pic_path+LX_thumb_prefix+"machinery5.gif";

LXLinks[2][0] = LX_pic_path+LX_thumb_prefix+"warehouse1.gif";
LXLinks[2][1] = LX_pic_path+LX_thumb_prefix+"warehouse2.gif";
LXLinks[2][2] = LX_pic_path+LX_thumb_prefix+"warehouse3.gif";
LXLinks[2][3] = LX_pic_path+LX_thumb_prefix+"warehouse4.gif";
//photo link
LXPhoto[0][0] = LX_pic_path+LX_photo_prefix+"factory1.jpg";
LXPhoto[0][1] = LX_pic_path+LX_photo_prefix+"factory2.jpg";
LXPhoto[0][2] = LX_pic_path+LX_photo_prefix+"factory3.jpg";
LXPhoto[0][3] = LX_pic_path+LX_photo_prefix+"factory4.jpg";

LXPhoto[1][0] = LX_pic_path+LX_photo_prefix+"machinery1.jpg";
LXPhoto[1][1] = LX_pic_path+LX_photo_prefix+"machinery2.jpg";
LXPhoto[1][2] = LX_pic_path+LX_photo_prefix+"machinery3.jpg";
LXPhoto[1][3] = LX_pic_path+LX_photo_prefix+"machinery4.jpg";
LXPhoto[1][4] = LX_pic_path+LX_photo_prefix+"machinery5.jpg";

LXPhoto[2][0] = LX_pic_path+LX_photo_prefix+"warehouse1.jpg";
LXPhoto[2][1] = LX_pic_path+LX_photo_prefix+"warehouse2.jpg";
LXPhoto[2][2] = LX_pic_path+LX_photo_prefix+"warehouse3.jpg";
LXPhoto[2][3] = LX_pic_path+LX_photo_prefix+"warehouse4.jpg";

//Next
function LXnext_factory() {

if (LXLinks[0][LXcurrent_factory+1]) {
alert(LXLinks[0][LXcurrent_factory+1]);
getpic(LXLinks[0][LXcurrent_factory+1],'factory');
document.getElementById('LXAhref_factory').href=LXPhoto[0][LXcurrent_factory+1];
//alert(document.getElementById('LXAhref').href);
++LXcurrent_factory;
   }
else LXfirst_factory();
}

function LXnext_machinery() {

if (LXLinks[1][LXcurrent_machinery+1]) {
alert(LXLinks[1][LXcurrent_machinery+1]);
getpic(LXLinks[1][LXcurrent_machinery+1],'machinery');
document.getElementById('LXAhref_machinery').href=LXPhoto[1][LXcurrent_machinery+1];

++LXcurrent_machinery;
   }
else LXfirst_machinery();
}

function LXnext_warehouse() {

if (LXLinks[2][LXcurrent_warehouse+1]) {

getpic(LXLinks[2][LXcurrent_warehouse+1],'warehouse');
document.getElementById('LXAhref_warehouse').href=LXPhoto[2][LXcurrent_warehouse+1];

++LXcurrent_warehouse;
   }
else LXfirst_warehouse();
}

//Previous
function LXprevious_factory() {
if (LXcurrent_factory-1 >= 0) {

getpic(LXLinks[0][LXcurrent_factory-1],'factory');
document.getElementById('LXAhref_factory').href=LXPhoto[0][LXcurrent_factory-1];
--LXcurrent_factory;
   }
else LXlast_factory();
}

function LXprevious_machinery() {
if (LXcurrent_machinery-1 >= 0) {

getpic(LXLinks[1][LXcurrent_machinery-1],'machinery');
document.getElementById('LXAhref_machinery').href=LXPhoto[1][LXcurrent_machinery-1];
--LXcurrent_machinery;
   }
else LXlast_machinery();
}

function LXprevious_warehouse() {
if (LXcurrent_warehouse-1 >= 0) {

getpic(LXLinks[2][LXcurrent_warehouse-1],'warehouse');
document.getElementById('LXAhref_warehouse').href=LXPhoto[2][LXcurrent_warehouse-1];
--LXcurrent_warehouse;
   }
else LXlast_warehouse();
}

function LXfirst_factory() {
LXcurrent_factory = 0;
document.getElementById('LXAhref_factory').href=LXPhoto[0][LXcurrent_factory];
}

function LXfirst_machinery() {
LXcurrent_machinery = 0;
document.getElementById('LXAhref_machinery').href=LXPhoto[1][LXcurrent_machinery];
}

function LXfirst_warehouse() {
LXcurrent_warehouse = 0;
document.getElementById('LXAhref_warehouse').href=LXPhoto[2][LXcurrent_warehouse];
}

function LXlast_factory() {
LXcurrent_factory = LXLinks[0].length-1;
getpic(LXLinks[0][LXcurrent_factory],'factory');
document.getElementById('LXAhref_factory').href=LXPhoto[0][LXcurrent_factory];
}

function LXlast_machinery() {
LXcurrent_machinery = LXLinks[1].length-1;
getpic(LXLinks[1][LXcurrent_machinery],'machinery');
document.getElementById('LXAhref_machinery').href=LXPhoto[1][LXcurrent_machinery];
}

function LXlast_warehouse() {
LXcurrent_warehouse = LXLinks[2].length-1;
getpic(LXLinks[2][LXcurrent_warehouse],'warehouse');
document.getElementById('LXAhref_warehouse').href=LXPhoto[2][LXcurrent_warehouse];
}

function LXap(text) {
document.LXslideform.LXslidebutton.value = (text == "Stop") ? "Start" : "Stop";
LXrotate();
}

function LXrotate() {

LXcurrent_factory = LXcurrent_factory == LXLinks[0].length-1 ? 0 : LXcurrent_factory+1;
LXcurrent_machinery = LXcurrent_machinery == LXLinks[1].length-1 ? 0 : LXcurrent_machinery+1;
LXcurrent_warehouse = LXcurrent_warehouse == LXLinks[2].length-1 ? 0 : LXcurrent_warehouse+1;
//alert(LXcurrent_factory+"\n"+LXLinks[0].length);
getpic(LXLinks[0][LXcurrent_factory],'factory');
document.getElementById('LXAhref_factory').href=LXPhoto[0][LXcurrent_factory];
getpic(LXLinks[1][LXcurrent_machinery],'machinery');
document.getElementById('LXAhref_machinery').href=LXPhoto[1][LXcurrent_machinery];
getpic(LXLinks[2][LXcurrent_warehouse],'warehouse');
document.getElementById('LXAhref_warehouse').href=LXPhoto[2][LXcurrent_warehouse];

window.setTimeout("LXrotate()", LXrotate_delay);
//}
}

function getpic(src,itype) {
//Modified by Edison tsai at 10:20 12/03/07 for other style
document.getElementById('pspace_'+itype).innerHTML = '<img src="'+src+'" id="qimg_'+itype+'" border="0" />';
//running with corner
/*if(cornerOnload) cornerOnload(); if(isIE){addIECorners(); }else {addCorners();}*/

}
function iOnClick(text){
document.LXslideform.LXslidebutton.value = (text == "Stop") ? "Start" : "Stop";
LXrotate();
}


var myimages=new Array()
function preloadimages(){
if (document.images){
for (i=0;i<preloadimages.arguments.length;i++){
myimages[i]=new Image()
myimages[i].src=preloadimages.arguments[i]
}
}
}
preloadimages(LXLinks[0][0],LXLinks[0][1],LXLinks[0][2],LXLinks[0][3],LXLinks[1][0],LXLinks[1][1],LXLinks[1][2],LXLinks[1][3],LXLinks[1][4],LXLinks[2][0],LXLinks[2][1],LXLinks[2][2],LXLinks[2][3]);