/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

var the_timeout;
var key = 0;
var pre = -1;
var num = 3;

function rotateMainbg(){
    for(var i=0;i<num;i++){
        //alert(i+1);
        $("#btn"+(i+1)).attr("class", "");
        $('#img'+(i+1)).css("z-index", "-1000");
    }
    if((pre!=-1)&&(pre!=key)) $('#img'+(pre+1)).css("z-index", "1500");
    $('#img'+(key+1)).css("z-index", "1000");
    $('#btn'+(key+1)).attr("class", "current");
    if((pre!=-1)&&(pre!=key)) $("#bg_main_img0"+(pre+1)).fadeOut(500);
    $("#bg_main_img0"+(key+1)).fadeIn(500);
    pre = key;
    key++;
    if (key >= num){ key = 0; }
    var function_string = "rotateMainbg("+key+");";
    the_timeout = setTimeout(function_string,4000);
}
function showImage(index){
    key = index;
    clearTimeout(the_timeout);
    rotateMainbg();
}
rotateMainbg();

function goto_byselect(thelink, method) {
    if(thelink.value!= 'Select Country')  window.open(thelink.value);
}

