var flag = 0;
var jStart = 0;
var drpObj = null;

function hpInit() {
    if(jobList) {
        showjobs("jobs1");
        window.setInterval("opacity()", 8000);
    }
}

function showjobs(obj) {    
    
    if(jStart >= 20) {
        jStart = 0;
    }
    
    jobdivs = "";
    jobdivs += "<ul>";
    
    for(var i = jStart;i<= jStart +4;i++) {
    	var jobListTmp =jobList[i].split("|");
    	jobdivs += "<li class=\"jobheader\" style=\"list-style-image:url(/images/gen/home/arrow.gif)\"><a href=\"/wrk/result/detail/view.do?jobcat="+jobListTmp[1]+"&jobId="+jobListTmp[0]+"\"> <b>"+jobListTmp[2]+"</b></a></li>";	
    } 
    		
    jobdivs += "</ul>";
    document.getElementById(obj).innerHTML = jobdivs;
    jStart += 5;
    
}


function opacity() {	

    var millisec = 500;
    var speed = Math.round(millisec / 100);
    var timer = 0;
    
    if(flag == 0) {
        
    	for(i = 100; i >= 1; i--) {
            setTimeout("changeOpac(" + i + ",'jobs1')",(timer * speed));
            timer++;
		}
        
    
    	for(i = 0; i <= 100; i++) {
            setTimeout("changeOpac(" + i + ",'jobs2')",(timer * speed));
            timer++;
            
        }
		flag = 1;
        document.getElementById('jobs1').style.zIndex = "-1"; 
        document.getElementById('jobs2').style.zIndex = "10";
    			
    } 
    else
    {
    	for(i = 100; i >= 1; i--) {
    	            setTimeout("changeOpac(" + i + ",'jobs2')",(timer * speed));
    	            timer++;
    	             
    			}
        
    
    	for(i = 0; i <= 100; i++) {
            setTimeout("changeOpac(" + i + ",'jobs1')",(timer * speed));
            timer++;
            
        }	
		flag = 0;
        document.getElementById('jobs2').style.zIndex = "-1"; 
        document.getElementById('jobs1').style.zIndex = "10";
    	
    }    
}

function changeOpac(opacity, id) {
	
	if(opacity == 0) {
    	showjobs(id, jStart);
    }
    
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100);  // CSS 3
    object.MozOpacity = (opacity / 100); // Mozilla Browser
    object.KhtmlOpacity = (opacity / 100); // Konquerer, Safari
    object.filter = "alpha(opacity=" + opacity + ")"; // IE
} 

/*function switchLinkImg(obj, img) {
    obj.src = "/images/gen/home/"+img+".gif";
}*/

function headSwitcher(mode, basepath, imgname) {
	
	if(mode == 1) {
		document.getElementById("txt2").style.display = "none";
		document.getElementById("txt1").style.display = "block";
		document.getElementById("jobclient").firstChild.className = "txtBigWhite";
		document.getElementById("jobclient").className = "activ";
		document.getElementById("jobsearch").firstChild.className = "txtMidGrey";
		document.getElementById("jobsearch").className = "inactiv";
    document.getElementById("man").src = basepath+imgname;
		document.getElementById("jobclient").style.background = "url("+basepath+"head_btn1.gif) no-repeat";
		document.getElementById("jobsearch").style.background = "url("+basepath+"head_btn2.gif) no-repeat";
	} else if( mode == 2) {
		document.getElementById("txt1").style.display = "none";
		document.getElementById("txt2").style.display = "block";
		document.getElementById("jobclient").firstChild.className = "txtMidGrey";
		document.getElementById("jobclient").className = "inactiv";
		document.getElementById("jobsearch").firstChild.className = "txtBigWhite";
		document.getElementById("jobsearch").className = "activ";
        document.getElementById("man").src = basepath+imgname;
		document.getElementById("jobclient").style.background = "url("+basepath+"head_btn2.gif) no-repeat";
		document.getElementById("jobsearch").style.background = "url("+basepath+"head_btn1.gif) no-repeat";
	}
}





		$(document).ready(function(){
			rotateAuctions();
		});
		
		function rotateAuctions()
		{
			
			$(".jCarouselLite").jCarouselLite({
					auto: 1000,
					speed: 1000,
					vertical: true,
					visible: 5,
					circular: true
			});
		}



