function RenderMail(user,domain,linktext,cssclass){
	var mailto=user+'@'+domain;
	var txt=linktext;
	if(txt.length<1)txt=mailto;
	if(cssclass.length>0){
		document.write('<a class='+cssclass+' href=mailto:'+mailto+' onMouseOver=this.style.color="'+lnkColor+'"; onMouseOut=this.style.color="#000000";>'+txt+'</a>');
	}else{
		document.write('<a href=mailto:'+mailto+'>'+txt+'</a>');
	}

}

/** NAVIGATION **/
var mlddm_shiftx       = 3;
var mlddm_shifty       = -3;	
var mlddm_timeout      = 250;
var mlddm_effect       = 'slide';
var mlddm_effect_speed = 200;
var mlddm_orientation  = 'h';
var mlddm_direction    = 1;
var mlddm_delay        = 50;
var mlddm_highlight    = 1;
var mlddm_closeonclick = 0;

/** JQUERY**/
$(document).ready(function(){
	UpdateLinks();
	$('#slideshow1').coinslider();
	$('#slideshow2').coinslider();
	
	$('#quick_gruppe').change(function(){ location.href = $('#quick_gruppe option:selected').val(); });
	$('#quick_kategorie').change(function(){ location.href = $('#quick_kategorie option:selected').val(); });
	$('#quick_hersteller').change(function(){ location.href = $('#quick_hersteller option:selected').val(); });
	$('#quick_typ').change(function(){ location.href = $('#quick_typ option:selected').val(); });
	$('#quick_standort').change(function(){ location.href = $('#quick_standort option:selected').val(); });
	
	$('.product-item').click(function(){
		var id = $(this).attr('id').substr(3);
		location.href = $('#lnk'+id).attr('href');
	});
	
	$('.square').click(function(){
		var id = $(this).attr('id').substr(7);
		var count = $('#imgCount').val();
		
		for(i = 0; i < count; i++){
			if(i != id){
				$('#square-'+i).css('background-color', '#87888a');
				$('#img-'+i).fadeOut();
			}
		}
		$('#square-'+id).css('background-color', '#e20031');
		$('#img-'+id).fadeIn();
	});
	
	$('#btnPrint').click(function(){ print(); });
	$('#standortSelect').change(function(){
		var id = $('#standortSelect option:selected').val();
		$('#standortSelect option').each(function(){ 
			if(this.value != id && this.value != "all") $('.angebot'+this.value).slideUp();
		});
		if($('#standortSelect option:selected').val() == "all"){
			$('#standortSelect option').each(function(){
				$('.angebot'+this.value).slideDown();
			});
		}else{
			$('.angebot'+id).slideDown();
		}
		
	});
	
	$('.anfrage').click(function(){
		var id = $(this).attr('id').substr(8);
		$('#ansprechpartner-'+id).slideToggle();
	});
	
	$('#btnAnfrage').click(function(){
		$('#anfForm').slideToggle();
		$('html,body').animate({scrollTop: $('#anfForm').offset().top},'slow');
	});
	
	$('#hdrVortrag').click(function(){
		
		if($('#divVortrag').css('display') == 'none'){
			$(this).html('Vortr&auml;ge ausblenden&hellip;');
		}else{
			$(this).html('Vortr&auml;ge anzeigen&hellip;');
		}
		$('#divVortrag').slideToggle();
		$('html,body').animate({scrollTop: $('#divVortrag').offset().top},'slow');
	});
	
});

function moveImages(){
	var count = $('#imgCount').val();
	$('#square-0').css('background-color', '#e20031');
	for($i = 0; i < count; i++){
		$('#img-'+i).css('margin-left', (($('#productdetail-image').width() - $('#img-'+i).width()) / 2)+'px');
	}
}

/** LINKS **/
function UpdateLinks() {  
	if (!document.getElementsByTagName) return;  
	var anchors = document.getElementsByTagName("a");  
	for (var i=0; i<anchors.length; i++) {  
		var anchor = anchors[i];  
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") anchor.target = "_blank";  
	}
	var imgs = document.getElementsByTagName("img");
	for (var i=0; i<imgs.length; i++){
		var img = imgs[i];
		if(img.getAttribute("src").indexOf("../") == 0) img.src = img.getAttribute("src").replace("../", "http://"+window.location.host+"/");
	}
}
