/* KR - global stuff  */

$(document).ready(function(){
    
    jQuery('ul#globalNav').superfish();
    
    jQuery('ul#topNav').superfish();
    
    autoFill($("#searchfield"), "검색");
    
    function autoFill(id, v){
		$(id).css({ color: "#b2adad" }).attr({ value: v }).focus(function(){
	    	if($(this).val()==v){
	    		$(this).val("").css({ color: "#333" });
	    	}
	    }).blur(function(){
	    	if($(this).val()==""){
	    		$(this).css({ color: "#b2adad" }).val(v);
	    	}
	    });
	    
	}
    
});

function expander(theID) {
	spanID = document.getElementById(theID);
	spanID.style.display = (spanID.style.display == 'block') ? 'none' : 'block';
}


/****************************************** 
 * LOGO ANIMATION
 *****************************************/

// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 2000;

// Specify the image files
var Pic = new Array(); 

// to add more images, just continue
// the pattern, adding to the array below

// diese auskommentierte bilder def muss denn ins flex rein

	//Pic[0] = '/media/img/logos/01.gif';
	//Pic[1] = '/media/img/logos/02.gif';
	//Pic[2] = '/media/img/logos/03.gif';
	//Pic[3] = '/media/img/logos/04.gif';
	//Pic[4] = '/media/img/logos/05.gif';
	//Pic[5] = '/media/img/logos/06.gif';
	//Pic[6] = '/media/img/logos/07.gif';
	//Pic[7] = '/media/img/logos/08.gif';
	//Pic[8] = '/media/img/logos/09.gif';
	//Pic[9] = '/media/img/logos/10.gif';
	//Pic[10] = '/media/img/logos/11.gif';

// Run SlideShow

var t;
var j = 0;
var p = Pic.length;

var preLoad = new Array();
for (i = 0; i < p; i++){
   preLoad[i] = new Image()
   preLoad[i].src = Pic[i]
}

function runSlideShow(){
	if (document.getElementById("SlideShow") != null) {
   		document.getElementById("SlideShow").src = preLoad[j].src;
   		j = j + 1;
   		if (j > (p-1)) j=0;
   		t = setTimeout('runSlideShow()', slideShowSpeed);
	}
}


//Run function on window load.
function loadFunctions() {
	runSlideShow();
}
window.onload = loadFunctions