// JavaScript Document
var pages = new Array("webdesign", "webapplicaties", "software", "flash");
 
var pageShowing; 
var stopAutomatedSwitch = true;
var automatedSwitchStopped = false;
var curAutomatic = 0;
 
jQuery.noConflict();
jQuery(document).ready(function(){
	
	if(jQuery.browser.msie && jQuery.browser.version == 6){
		jQuery(".hc_page_pic").supersleight();
	}
	for(var i = 0; i < pages.length; i++){
		var pagetoshow = "#hc_page_"+pages[i];
		var curlink = "#hc_link_"+pages[i];
		jQuery(curlink).bind("click", {page: pages[i]}, showPage);
	}    
	
	automatedSwitch();
	
});

function automatedSwitch(){
	setInterval(switchToNext, 8000);	
}

function switchToNext(){
	if(!automatedSwitchStopped){
		curAutomatic++;
		if(curAutomatic < pages.length){
			curAutomatic
		}else{
			curAutomatic = 0;	
		}
	
		var nextlink = "#hc_link_"+pages[curAutomatic];
		stopAutomatedSwitch = false;
		jQuery(nextlink).click();
	}
}

function clearAllPages(attributeClass){	
	for(var i = 0; i < pages.length; i++){
		var pn = "hc_page_"+pages[i];
		var pl = "hc_link_"+pages[i];
		var pln = "unselected";
		var e = document.getElementById(pn);
		e.style.display="none";		
		var e2 = document.getElementById(pl);
		e2.setAttribute(attributeClass, pln);
	}
}

function showPage(event){
	if(stopAutomatedSwitch){
		clearInterval(switchToNext);
		automatedSwitchStopped = true;
	}
	stopAutomatedSwitch = true;	
	
	var pagename = event.data.page;
	
	jQuery(".hc_page:visible").fadeOut(500, function(){showPageByName(pagename)});
	return false;
}

function showPageByName(pagename){
	/* find out which is the browser */
	var isIE = (window.ActiveXObject)?true:false;	 
	/* the name of the attribute, depending on the browser */
	var attributeClass = (isIE)?"className":"class";
	
	clearAllPages(attributeClass);
	var pn = "#hc_page_"+pagename;
	var pl = "hc_link_"+pagename;
	var pln = "selected";
	document.getElementById(pl).setAttribute(attributeClass, pln); 
	pageShowing = pagename;
	jQuery(pn).fadeIn(500);
	return false;
}


/*
// JavaScript Document
var pages = new Array("webdesign", "webapplicaties", "software", "flash");
 
jQuery.noConflict();
jQuery(document).ready(function(){
	
	if(jQuery.browser.msie && jQuery.browser.version == 6){
		jQuery(".hc_page_pic").supersleight();
	}
	for(var i = 0; i < pages.length; i++){
		var pagetoshow = "#hc_page_"+pages[i];
		var curlink = "#hc_link_"+pages[i];
		jQuery(curlink).bind("click", {page: pages[i]}, showPage);
	}    
	
});



function clearAllPages(attributeClass){	
	for(var i = 0; i < pages.length; i++){
		var pn = "hc_page_"+pages[i];
		var pl = "hc_link_"+pages[i];
		var pln = "unselected";
		var e = document.getElementById(pn);
		e.style.display="none";		
		var e2 = document.getElementById(pl);
		e2.setAttribute(attributeClass, pln);
	}
}

function showPage(event){
	var pagename = event.data.page;

	var isIE = (window.ActiveXObject)?true:false;	 
	var attributeClass = (isIE)?"className":"class";
	
	clearAllPages(attributeClass);
	var pn = "#hc_page_"+pagename;
	var pl = "hc_link_"+pagename;
	var pln = "selected";
	document.getElementById(pl).setAttribute(attributeClass, pln);    
	jQuery(pn).fadeIn(1000);
	return false;
}
*/
