var global = new Array();
global['url'] = window.location.protocol+"//"+window.location.host+"/";

function get_nav(){
	return navigator.appName;
}

ready(function(){set_slider()});

function fetch_obj(obj_name){
	var selected = document.getElementsByName(obj_name);
	return selected;
}

function get_obj(obj_id){
	var selected = document.getElementById(obj_id);
	return selected;
}

function ready(func){
	window.onload = func;
}

function slider(x){
    if (x < 2){
        x +=1;
    }else{
        x = 1;
    }
    change_slide(get_obj("slide_"+x));
    setTimeout('slider('+x+')',7500);
}

function change_slide(obj){
	var obj_array = obj.id.split("_");
	for(var x=1; x <= 2; x++){
		if(x != obj_array[1]){
			get_obj("slide_"+x).className = "but_1";
			get_obj("slide_"+x).onmousedown = function(){change_slide(this);}
		}else{
			get_obj("slide_"+x).className = "but_hover";
			get_obj("slide_"+x).onmousedown = "";
			//get_obj("slide").style.background = "transparent url('img/banner"+x+".png') no-repeat";
            $("#banner"+global['current_banner']).fadeOut("slow");
            $("#banner"+x).fadeIn("slow");
            global['current_banner'] = x;
		}
	}
}

function set_slider(){
    
	get_obj("slide_1").className = "but_hover";
    $("#slide").append("<div id=\"banner1\" style=\"display:block;width:675px;height:217px;position:absolute;top:0px;left:0px;display: block;background: transparent url('"+global['url']+"img/banner1.png') no-repeat;\"></div>");
    
	for(var x=2; x <= 2; x++){
        $("#slide").append("<div id=\"banner"+x+"\" style=\"display:none;width:675px;height:217px;position:absolute;top:0px;left:0px;background: transparent url('"+global['url']+"img/banner"+x+".png') no-repeat;\"></div>");
		get_obj("slide_"+x).className = "but_1";
		get_obj("slide_"+x).onmousedown = function(){change_slide(this);}
	}
    global['current_banner'] = 1;
    setTimeout('slider(1)',7500);
}
