var lang = 0;

function openPopup(type,cat,id) {
	var url = '';
	var width = 820; var height = 620;
	var left = 30, top = 30;
	switch (type) {
		case 'photo':
			url = cat + '/img/h';
			if (lang==1) url = '../../photos/' + url;
			break;
	}
	url += id+'.jpg';
	window.open(url,'_blank',"width=" + width + ", height=" + height 
				+ ", left=" + left + ", top=" + top
				+ ", status=no, titlebar=no, menubar=no, toolbar=no, scrollbars=yes");
}

var siteSection = '';
function init() {
	var docClass = document.getElementsByTagName('html')[0].className;
	if (docClass.substr(0,2) == 'en') lang = 1;
	if (docClass.indexOf('course')!=-1)
		siteSection = 'course';
	else if (docClass.indexOf('trainer')!=-1)
		siteSection = 'trainer';
	if ( siteSection == 'course' || siteSection == 'trainer' ) {
		setInterval('rotateInbanner();',4000);
	}
}

var rotatePhase = false;
function rotateInbanner() {
	var divInbanner = document.getElementById('inbanner');
	var img = divInbanner.getElementsByTagName('img')[0];
	
	var imgPath = '../images/';
	if (siteSection == 'course') imgPath += 'inbanner';
	else if (siteSection == 'trainer') imgPath += 'inbanner-trainers';
	if (rotatePhase)
		img.src = imgPath + '.jpg';
	else
		img.src = imgPath + '2.jpg';
	rotatePhase = !rotatePhase;
}

if (window.addEventListener)
	window.addEventListener("load", init, false);
else if (window.attachEvent)
	window.attachEvent("onload", init);


