var d=document;

/** if on abo page redirect to SSL **/
var getstr = location.search.toLowerCase();
if (location.protocol.toLowerCase() == 'http:' && (getstr.indexOf('id=abo') > -1 || getstr.indexOf('id=46') > -1)) {
	location = location.href.replace('http:','https:');
} else if(location.protocol.toLowerCase() == 'https:' && getstr.indexOf('id=abo') == -1 && getstr.indexOf('id=46') == -1 ) {
	location = location.href.replace('https:','http:');
}


function show(element){
	element.className += "hover";
}
function hide(element){
	element.className = element.className = "";
}

$(document).ready(function(){
	//$("ul.menu li a:contains('Shop')").css("color", "#7c8687");
	
		$('#bookmarklinks').click(function() {
			mslink = 'http://www.myspace.com/index.cfm?fuseaction=postto&u='+escape(location.href);
			fblink = 'http://de.facebook.com/sharer.php?u='+escape(location.href);
			twlink = 'http://twitter.com/home?status='+escape(location.href);
			$('#bookmarks').html('<a href="'+mslink+'" id="mslink" target="_blank">MySpace</a><a href="'+fblink+'" id="fblink" target="_blank">Facebook</a><a href="'+twlink+'" id="twlink" target="_blank">Twitter</a>');
			$('#bookmarks').css('display','block');
		});

	if(d.getElementById('parent-title')) {
		$('#mitte').find('p.bodytext').slice(0,1).prepend($('#parent-title'));
	}
	if(d.getElementById('aktuell_navi')) {
		jQuery('#aktuell_navi').Accordion({
			active: false,
			header: '.head',
			navigation: true,
			event: 'click',
			autoheight: true ,
			animated: 'bounceslide'
		});
		jQuery('#aktuell_navi').activate('#akt_active');
	}
	if(d.getElementById('abo-block')) {
		jQuery("#abo-block").codaSlider();
		/*$('#abo-block').pager('div.page', {
			navId: 'abo-nav',
			navAttach: 'prepend',
			
			prevText: 'zur&uuml;ck',
			nextText: 'weiter',
			linkText: ['Abo-Typ', 'Pr&auml;mien/Geschenke', 'Kundendaten', 'Lieferung', 'Zahlungsart', 'Bestell-&Uuml;bersicht']
		});*/
		checkform();
		$('#abo-block').click(function() {
			checkform();
		});
		$('#abo-block input').blur(function() {
			checkform();
		});
	}
	if(d.getElementById('imgplay1')) {
		$('#imgplay1').cycle({
			speed: 1200,
			timeout: 7500,
			pause: 1
		});
		$('#imgplay2').cycle({
			delay: 2000,
			speed: 1200,
			timeout: 7500,
			pause: 1
		});
	}
	if(d.getElementById('movedown')) {
//		alert($('#right').height());
		$('#movedown').css('margin-top',($('#mitte').height()-984)+'px');
	}
});


