$(window).load(function() {

	//Prüfen ob Browser mobil ist
	var mobile_check = jQuery.browser.mobile;
	
	if (mobile_check == true) {
		location.href = "http://m.hochschwarzwald-card.de";
	}

	FB.init({
		 appId  : '102318529820408',
		 status : true,
		 cookie : true,
		 xfbml  : true
		});


	$.fn.qtip.styles.mystyle = {
		width: 120,
		background: '#fff',
		color: 'black',
		textAlign: 'left',
		border: {
			width: 5,
			radius: 3,
			color: '#fff'
		},
		tip: {
			corner: 'topMiddle',
			size: {
    	        x: 20,
        	    y : 8
         	}	
		}
	}
	
	$('#language a[href][title]').each(function() {
		$(this).qtip({
			content: { text: false },
			position: {
				corner: { tooltip: 'topMiddle', target: 'bottomMiddle' },
				adjust: { x: 0, y: 0 }
			},
			hide: { fixed: true, delay: 1000, effect: 'slide' },
			show: { effect: { type: 'slide' } },
			style: 'mystyle'
		});
	});

    $("ul#tabs1").tabs("div#panes1 > div.item"); 
    $("ul#tabs2").tabs("div#panes2 > div.item");
    $("ul#tabs3").tabs("div#panes3 > div.item");

	$('a[rel=gallery]').lightBox();
	$('.thumb a').lightBox();
	$('.thumb_line a').lightBox();
	$('.thumb_link a').lightBox();

	if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.indexOf("IE 6.0") != "-1") {
		$('#iewarning').show();
	} else {
    $("a.trigger").each(function (i) {
		$(this).tooltip({ 
	    	position: ['top', 'right'], 
		    offset: [0, - ($(this).width()+20)],
		    opacity: 0.9
		});    	
    });	
    }



	jQuery('.sexy-bookmarks a.external').click(function() {
		// get the current URL & encode it into the standard URI
		var url = encodeURIComponent(window.location.href), desc = '';
	
		// parse the description for the above URL by the text() method of jQuery
		// the text must be placed in the P tag with ID="sexy-bookmarks-content"
		// so you can change the container of description with another tag and/or another ID
		if( jQuery('p.sexy-bookmarks-content').length ) {
			desc = encodeURIComponent(jQuery('p.sexy-bookmarks-content').text());
		}
	
		// detect the social bookmark site user want to share your URL
		// by checking the className of site that we'll declare in the HTML code
		// and assign the URL & description we got into the current anchor
		// then redirect to the clicked bookmark site, you can use window.open() method for opening the new window
		switch(this.parentNode.className) {
			case 'sexy-twittley':
				this.href += '?title=' + document.title + '&url=' + url + '&desc=' + desc + '&pcat=Internet&tags=';
				break;
			case 'sexy-digg':
				this.href += '?phase=2&title=' + document.title + '&url=' + url + '&desc=' + desc;
				break;
			case 'sexy-twitter':
				this.href += '?status=RT+@your_twitter_id:+' + document.title + '+-+' + url;
				break;
			case 'sexy-scriptstyle':
				this.href += '?title=' + document.title + '&url=' + url;
				break;
			case 'sexy-reddit':
				this.href += '?title=' + document.title + '&url=' + url;
				break;
			case 'sexy-delicious':
				this.href += '?title=' + document.title + '&url=' + url;
				break;
			case 'sexy-stumbleupon':
				this.href += '?title=' + document.title + '&url=' + url;
				break;
			case 'sexy-mixx':
				this.href += '?title=' + document.title + '&page_url=' + url + '&desc=' + desc;
				break;
			case 'sexy-technorati':
				this.href += '?add=' + url;
				break;
			case 'sexy-blinklist':
				this.href += '?Action=Blink/addblink.php&Title=' + document.title + '&Url=' + url;
				break;
			case 'sexy-diigo':
				this.href += '?title=' + document.title + '&url=' + url + '&desc=' + desc;
				break;
			case 'sexy-yahoobuzz':
				this.href += '?submitHeadline=' + document.title + '&submitUrl=' + url + '&submitSummary=' + desc + '&submitCategory=science&submitAssetType=text';
				break;
			case 'sexy-myspace':
				this.href += '?t=' + document.title + '&u=' + url;
				break;
			case 'sexy-facebook':
				this.href += '?t=' + document.title + '&u=' + url;
				break;
			case 'sexy-designfloat':
				this.href += '?title=' + document.title + '&url=' + url;
				break;
			case 'sexy-devmarks':
				this.href += '?posttitle=' + document.title + '&posturl=' + url + '&posttext=' + desc;
				break;
			case 'sexy-newsvine':
				this.href += '?h=' + document.title + '&u=' + url;
				break;
			case 'sexy-google':
				this.href += '?op=add&title=' + document.title + '&bkmk=' + url;
				break;
			case 'sexy-linkedin':
				this.href += '?mini=true&url='+url+'&title='+document.title+'&source=HochschwarzwaldCard';
				break;	
			case 'sexy-googlebuzz':
				this.href += '?url='+url+'&amp;imageurl=';
				break;	
		}
	})

});
