(function(a){a.effects.blind=function(b){return this.queue(function(){var d=a(this),c=["position","top","left"];var h=a.effects.setMode(d,b.options.mode||"hide");var g=b.options.direction||"vertical";a.effects.save(d,c);d.show();var j=a.effects.createWrapper(d).css({overflow:"hidden"});var e=(g=="vertical")?"height":"width";var i=(g=="vertical")?j.height():j.width();if(h=="show"){j.css(e,0)}var f={};f[e]=h=="show"?i:0;j.animate(f,b.duration,b.options.easing,function(){if(h=="hide"){d.hide()}a.effects.restore(d,c);a.effects.removeWrapper(d);if(b.callback){b.callback.apply(d[0],arguments)}d.dequeue()})})}})(jQuery);;

function reloadThisPage(){
      location.href=location.href;
}
function reloadMCSammelkorb(){
      jQuery("#mcsammelkorbtag").load("/content/ajax/ajax-mc-sammelkorb-view.jsp",{},function(){});
}
function addDocument2Sammelkorb(sid, callback){
      $.ajax({ type: 'POST', url: '/content/ajax/ajax-mc-sammelkorb.jsp', data: { addsid: sid }, success: callback });
      window.setTimeout("reloadMCSammelkorb()", 500);
}
function removeDocument2Sammelkorb(sid, callback){
      $.ajax({ type: 'POST', url: '/content/ajax/ajax-mc-sammelkorb.jsp', data: { removesid: sid }, success: callback });
      window.setTimeout("reloadMCSammelkorb()", 500);
}
function addDocument2Abo(sid, callback){
      $.ajax({ type: 'POST', url: '/content/ajax/ajax-mc-abo.jsp', data: { addsid: sid }, success: callback });
}
function removeDocument2Abo(sid, callback){
      $.ajax({ type: 'POST', url: '/content/ajax/ajax-mc-abo.jsp', data: { removesid: sid }, success: callback });
}
function addDocument2Materiallinklist(sid, callback){
      $.ajax({ type: 'POST', url: '/content/ajax/ajax-mc-materiallinkliste.jsp', data: { addsid: sid }, success: callback });
}
function removeDocument2Materiallinklist(sid, callback){
      $.ajax({ type: 'POST', url: '/content/ajax/ajax-mc-materiallinkliste.jsp', data: { removesid: sid }, success: callback });
}



function openPopup( url, width, height ){	
	if (!width) width = 640
	if (!height) height = 540
	LIBopenWindow(url,'popupCL1',width,height,null,null,"scrollbars, resizable").focus()
}
function openPopup_540( url, width, height ){	
	if (!width) width = 556
	if (!height) height = 540
	LIBopenWindow(url,'popupCL4',width,height,null,null,"scrollbars").focus()
}
function openPopupFonds( url, width, height ){	
	if (!width) width = 640
	if (!height) height = 470
	openPopupFondsWrapper(url, 'fonds', width, height)
}
function openPopupPortfolio( gen,isin ){
    if(gen!="" && isin!=""){
        var fonid = 'isin';
        var params='generation='+gen+'&'+fonid+'='+isin;
    }else 
    if(isin!="" && gen==""){
        var params='isin='+isin;
    }else if(gen!="" && isin==""){
        var params='generation='+gen;
    }
    return window.open('http://canada-life.fondsintern.de/Portfolio/Portfolio.php?'+params,'popup',
                       'width=800,height=600,scrollbars, resizable').focus(); 
}
function openPopupFonds1( url, width, height ){	
	if (!width) width = 640
	if (!height) height = 470
	openPopupFondsWrapper(url, 'fonds01', width, height)
}
function openPopupFonds2( url, width, height ){	
	if (!width) width = 640
	if (!height) height = 555
	openPopupFondsWrapper(url, 'fonds02', width, height)
}
function openPopupFonds3( url, width, height ){	
	if (!width) width = 640
	if (!height) height = 575
	openPopupFondsWrapper(url, 'fonds03', width, height)
}
function openPopupFondsWrapper(url, windowname, width, height){ // hier von intern referenzieren
  var prefix = "http://";
  if ( prefix == url.substring(0, prefix.length)){ // externer link
    LIBopenWindow(url,windowname,width,height,null,null,"toolbar, directories, status, scrollbars, resizable, menubar, location").focus()
  } else {
    LIBopenWindow(url,windowname,width,height,null,null,"scrollbars").focus()
  }
}
function openPopupWithoutScrollbarsAtCenter( url, width, height ){	
	if (!width) width = 640
	if (!height) height = 540
	var left = (screen.availWidth - width)/2;
	var top = (screen.availHeight - height)/2;
	LIBopenWindow(url,'popupCL2',width,height,left,top,"").focus()
}
function checkKey(keyevent){ // für Formulare, um gleiches Absendeverhalten biem IE zu erreichen
	if(keyevent.keyCode == "13") document.loginformular.submit();
}
function displayLayer(elementID, display){
	if (document.getElementById(elementID))
		document.getElementById(elementID).style.display = display ? 'inline' : 'none';
}
function showInfoWindow(elementID){
  $(elementID).setStyle('visibility', 'visible')
}
function hideInfoWindow(elementID){
  $(elementID).setStyle('visibility', 'hidden')
}
function openSelfCarePopup(url){
  var width = 1050; 
  var height = 850; 
  var left = (screen.availWidth - width)/2;
  var top = (screen.availHeight - height)/2;
  LIBopenWindow(url,'popupCLselfcare',width,height,left,top,"resizable, scrollbars, status").focus()
}
function openQuotationPopup(url){
  var width = 1050; 
  var height = 850; 
  var left = (screen.availWidth - width)/2;
  var top = (screen.availHeight - height)/2;
  LIBopenWindow(url,'popupCLquotation',width,height,left,top,"resizable, scrollbars, status").focus()
}




// MEDIACENTER Standard LINK
$(function(){
	function showOwnContextMenu(event){
		var box = $("#" + $(this).attr("id").replace("mcinfo_", "mcinfobox_") );
		var offset = $(this).offset();
		var x = event.pageX - (offset.left) - 20;
		var y = event.pageY - (offset.left) + 40; 
		box.css("left", x)
		box.css("top", y)
		box.fadeIn( 200 );
	}
	if($('.mcinfo')){
		$('.mcinfo').each(function(){
				var $this = $(this)
				$this.click( showOwnContextMenu )
				$this.bind("contextmenu", showOwnContextMenu )
				$this[0].oncontextmenu = function() {
					return false;
				}
			}
		)
		$('.mcinfobox').mouseleave(
			function(event){
				$(this).hide();
			}
		)
	}
})