/**
 * @author Michael Riedel
 */

function load_price (id,db_id)
{
	var i = document.getElementById("variante1").selectedIndex;
	var a_id = document.getElementById("variante1").options[i].value;
	$.ajax({
		url: "http://www.fahnenmasten-shop.de/ajax_handler.php?db_id="+db_id+"&a_id="+a_id,
		type: 'GET',
		success: function( neueDaten ) {
		    $('#'+id).html( neueDaten );
		}
	});
}

function Popup_Zentriert(link, breite, hoehe, name)
{
	// Errechnet Koordinaten, um das Popup zentriert zu platzieren
	links = (screen.width/2) - (breite/2);
	oben = (screen.height/2) - (hoehe/2);
	window.open(link, name,"height="+hoehe+",width="+breite+",top ="+oben+",left ="+links);
}

function faq_openone(id)
{
	faq_subquestions_count = $('.faq_subquestions').length;
	for (i = 0; i < faq_subquestions_count; i++){
		fs_class = $('.faq_subquestions')[i];
		fs_class.style.visibility = 'hidden';
		fs_class.style.position = 'absolute';
	}
	document.getElementById("faq_id"+id).style.visibility = 'visible';
	document.getElementById("faq_id"+id).style.position = 'relative';
}

function bookmark(page) {
	doc=encodeURIComponent(location.href);
	title=encodeURIComponent(document.title);
	switch(page) {
		case 'delicious':
		window.open('http://del.icio.us/post?url='+doc+'&title='+title);
		break;
		case 'mrwong':
		window.open('http://www.mister-wong.de/index.php?action=addurl&bm_url='+doc+'&bm_description='+title);
		break;
		case 'blinkList':
		window.open('http://www.blinklist.com/index.php?Action=Blink/addblink.php&Description=&Url='+doc+'&Title='+title);
		break;
		case 'yahoo':
		window.open('http://myweb2.search.yahoo.com/myresults/bookmarklet?u='+doc+'&t='+title);
		break;
		case 'yigg':
		window.open('http://yigg.de/neu?exturl='+doc+'&exttitle='+title);
		break;
		case 'furl':
		window.open('http://www.furl.net/storeIt.jsp?u='+doc+'&t='+title);
		break;
		case 'folkd':
		window.open('http://www.folkd.com/submit/page/'+doc);
		break;
		case 'google':
		window.open('http://www.google.com/bookmarks/mark?op=add&hl=de&bkmk='+doc+'&title='+title);
		break;
		case 'oneview':
		window.open('http://beta.oneview.de:80/quickadd/neu/addBookmark.jsf?URL='+doc+'&title='+title);
		break;
	}
}

/** ------------------------- ImgSlider ------------------------- */
$(window).bind("load", function() { 
    $("div#ImgSlider").slideView();  
});

var theInt = null;
var $crosslink, $navthumb;
var curclicked = 0;

theInterval = function(cur){
	clearInterval(theInt);
					
	if( typeof cur != 'undefined' ){
		curclicked = cur;
	}
	$crosslink.removeClass("active-thumb");
	$navthumb.eq(curclicked).addClass("active-thumb");
	$("div#stripTransmitter0 ul li a").eq(curclicked).trigger('click');
				
	theInt = setInterval(function(){
		$crosslink.removeClass("active-thumb");
		$navthumb.eq(curclicked).addClass("active-thumb");
		$("div#stripTransmitter0 ul li a").eq(curclicked).trigger('click');
		curclicked++;
		if( 3 == curclicked )
			curclicked = 0;
	}, 10000);
};
			
$(function(){
	$navthumb = $(".nav-thumb");
	$crosslink = $(".cross-link img");
				
	$navthumb.click(function() {
		var $this = $(this);
		theInterval($this.parent().attr('href').slice(1) - 1);
		return false;
	});		
	theInterval();
});
