//<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
	jQuery('#cf_rosswald').crossFader({
		height: 106,
		delay: 3000,
		overlay: 'http://www.rro.ch/cms/ee/themes/weather/overlay.png',
		href: 'javascript: showPancam(\'17\', \'Panoramakamera Rosswald\');'
	});
});
function changeWeatherContent(day, index, region) {
	jQuery.ajax({
		url: 'http://www.rro.ch/cms/ee/index.php/wetter/weather_content',
		data: {
			day: day,
			region: region
		},
		success: function(data) {
			var tablist = $('#tablist > li');
			tablist.each(function(i) {
				jQuery(this).removeClass('active');
				if (i == index) jQuery(this).addClass('active');
			});
			jQuery('#weather_content').html(data);
		}
	});
    changeWeatherText(day, region);
}

function changeWeatherText(day, region) {
	jQuery.ajax({
		url: 'http://www.rro.ch/cms/ee/index.php/wetter/weather_text',
		data: {
			day: day,
			region: region
		},
		success: function(data) {$('#weather_text').html(data);}
	});
}

function changeSubRegion(subReg, index) {
	jQuery.ajax({
		url: 'http://www.rro.ch/cms/ee/index.php/wetter/regional_content',
		data: {
			subReg: subReg,
			reg: 'regionen'
		},
		success: function(data) {
			var tablist = jQuery('#tablist2 > li');
			tablist.each(function(i) {
				jQuery(this).removeClass('active');
				if (i == index) jQuery(this).addClass('active');
				jQuery('#regional_content').html(data);
			});
		}
	});
}

function createTip(element, title, content) {
    if (element != null && element != "") {
    	jQuery('#'+element).qtip({
        	content: content,
            show: 'mouseover',
            hide: 'mouseout'
        });
        /*new Tip(element, content, {
            border: 1,
			radius: 1,
            width: 'auto',
			stem: 'bottomLeft',
            hook: {tip: 'bottomLeft', mouse: true},
            offset: {x: 0, y: -5}
        });*/
    }
}

function showCam(el) {
    var index = el.selectedIndex;
    if (isNaN(el.options[index].value)) {
        Lightview.show({
            href: el.options[index].value,
            rel: 'iframe',
            title: 'Wetterkamera ' + el.options[index].text,
            options: {
                width: 721,
                height: 407,
				topclose:true,
				scrolling:false
            }
        });
    } else {
        Lightview.show({
            href: 'http://www.rro.ch/walliswetter/incoming/webcams/' + el.options[index].value + '.jpg',
            title: el.options[index].text,
            options: {
                autosize: true
            }
        });
    }
}

function showCamFlight(flight) {
	Shadowbox.open({
		content: 'http://www.rro.ch/cms/ee/engine/templates/wetter/Flash/'+flight+'/kameraFlug.swf',
		player: 'swf',
		title: 'Kameraflug',
		height: 480,
		width: 640
	});
}

function showCamFlight2(flight) {
	flight = camFlightPrepareStr(flight);
    Shadowbox.open({
		content: 'http://www.rro.ch/cms/ee/engine/templates/wetter/Flash/'+flight+'/kameraFlug.swf',
		player: 'swf',
		title: 'Kameraflug',
		height: 480,
		width: 640
	});
}

function camFlightPrepareStr(str) {
	var arr = str.split('_');
    str = "";
    for (i = 0; i < arr.length; i++) {
    	str += arr[i].charAt(0).toUpperCase() + arr[i].substr(1);
    }
    return str;
}

function showWallisFlight() {
	Shadowbox.open({
		content: 'http://www.rro.ch/cms/ee/engine/templates/wetter/Flash/wallisFlug.html',
		player: 'iframe',
		title: 'Wallisflug',
		height: 456,
		width: 808
	});
}

function showWebcam(id) {
	/*Shadowbox.open({
		content: 'http://www.rro.ch/cms/ee/engine/templates/wetter/zeitraffer.php?id='+id,
		player: 'iframe',
		height: 595,
		width: 596
	});*/
	Shadowbox.open({
		content: 'http://www.rro.ch/walliswetter/incoming/webcams/'+id+'.jpg',
		player: 'img'
	});
}

function showPancam(id, titleStr) {
	Shadowbox.open({
        content: 'http://www.rro.ch/wetter/webcam/showCams.php?id='+id,
        player: 'iframe',
        title: titleStr,
        height: 410,
        width: 720
	});
}
