// CommerceConnector Integration 
$(document).ready(function() {
  	initCChandler();
});

function initCChandler() {
	$('a.jCClayerOpen').click(function() {
		
		$('body').prepend('<div id="ccInSiteLayer_bgr">&nbsp;</div>');
		$('div#ccInSiteLayer_bgr').height('100%').css('opacity','.7');
		$('body').prepend('<div id="ccInSiteLayer_content"><iframe src="'+$(this).attr('href')+'" width="978" height="522" frameborder="0" /></div>');
		
		$('div#ccInSiteLayer_bgr').click(function() {
			closeCClayer();
		});
		
		return false;
	
	});
}

function closeCClayer() {
	$('div#ccInSiteLayer_bgr').remove();
	$('div#ccInSiteLayer_content').remove();
}


$(document).ready(function() {
	
	/** BO - CommerceConnector Layer **/
	// initCChandler();
	/** EO - CommerceConnector Layer **/
	
	/** BO - CommerceConnector Loaderimage **/
	$('div#loader').fadeOut();
	/** EO - CommerceConnector Loaderimage **/
	
	/**
	$('.scroll-pane').jScrollPane({
		scrollbarWidth:16,
		scrollbarMargin:25,
		showArrows:true,
		arrowSize:16,
		wheelSpeed:45,
		dragMinHeight:40,
		animateTo:true
	});
	
	$('.scroll-pane-wide').jScrollPane({
		scrollbarWidth:16,
		scrollbarMargin:25,
		showArrows:true,
		arrowSize:16,
		wheelSpeed:45,
		dragMinHeight:40,
		animateTo:true
	});
	**/
	
	/**
	$('img.jClickZip').bind('mouseover', function() {
	
		var id = $(this).attr('alt');

		if (!$('div#jZip'+id)[0]) {
			$(this).css({'cursor':'default'}).unbind('click');
		}
		
	});
	**/	
	
	/**
	$('img.jClickZip').click(function() {
		
		$.each($('img.jClickZip'), function(i, val) {
			$(this).attr('src', '/fileadmin/Herma/php/cc/v2/img/zip_'+$(this).attr('alt')+'_off.gif');
		});

		var id = $(this).attr('alt');
		$(this).attr('src', '/fileadmin/Herma/php/cc/v2/img/zip_'+id+'_on.gif');

		var e;
		
		if ($('div.scroll-pane')[0]) {
			e = $('div.scroll-pane')[0];
		} else if ($('div.scroll-pane-wide')[0]) {
			e = $('div.scroll-pane-wide')[0];
		}
		
		e.scrollTo('#jZip'+id);
		
	});
	**/
	
	/** BO - ToolTip **/
	$('img.jqShowTooltip').bind('mouseenter', function() {
		
		$('div#TooltipContent').html( $(this).parent().find('div.Tooltip').html() );
		$('div#Tooltip').show();
				
		$('img.jqShowTooltip').mousemove(function(e){ 	
			$('div#Tooltip').css({'left':e.pageX-220, 'top':e.pageY+45-$('div#Tooltip').height()});
		}); 
		
	});

	$('img.jqShowTooltip').bind('mouseleave', function() {
		$('div#Tooltip').hide();
	});
	/** EO - ToolTip **/
	
});


var openpopupWindow=null;
function ccopenpopup (mypage,myname,w,h,pos,infocus){
	if(pos=='random'){
		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}
	if(pos=='center'){
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;
	} else if((pos!='center' && pos!='random') || pos==null){
		LeftPosition=100;TopPosition=100;
	}
	settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',location=yes,directories=no,menubar=yes,toolbar=yes,status=yes,scrollbars=yes,resizable=yes,dependent=no';
	openpopupWindow=window.open('',myname,settings);
	if(infocus=='front'){
		openpopupWindow.focus();
		openpopupWindow.location=mypage;
	}
}

function ccweb(){
	openpopup_leiste('http://www.commerce-connector.com','ccweb','1020','700','center','front');
}

