function closeSm(){
	curr = 0;
		var $l = $('.dd_l');
		var $r = $('.dd_r');
		var $t = $('.dd_tran');
		$l.animate({'height':'0px'},'fast');
		$r.animate({'height':'0px'},'fast');
		$t.css('height','0px');
		$('.submenu').animate({'margin-top':'-150px'},'fast');
		
	}

function showSm(id){
	var w;
	var lML;
	var rML;
	var tML;
	var h1 = false;
	switch(id){
		case '1':
		w = 233;
		h1 = true;
		tML = 1;
		rML = 222;
		break;
		case '2':
		w = 246;
		lML = 88;
		tML = 88;
		rML = 322;
		break;
		case '3':
		w = 246;
		lML = 208;
		tML = 208;
		rML = 442;
		break;
		case '4':
		w = 246;
		lML = 353;
		tML = 353;
		rML = 587;
		break;
		}
	
	var $l = $('.dd_l');
	var $t = $('.dd_tran');
	var $r = $('.dd_r');
	if(h1){$l.hide();}else{$l.show();$l.css('margin-left',lML);$l.animate({'height':'14px'},'fast');}
	$t.css('margin-left',tML);
	$t.css('width',w);
	$r.css('margin-left',rML);
	$t.css('height','2px');
	$t.fadeIn('fast');
	$r.show();$r.animate({'height':'14px'},'fast');
	}
	
	
// Produkt - Preview
var prodPrevCount = 1;
var prodPrevOn = true;
function slideRight(){
	if(prodPrevOn){
		var noi = 14;//Set Number Of Items
		if((prodPrevCount + 3) <= noi){var ref = prodPrevCount + 3;}else{var ref = (prodPrevCount + 3) - noi;}
		if((prodPrevCount + 2) <= noi){var ln = prodPrevCount + 2;}else{var ln = (prodPrevCount + 2) - noi;}
		var img = $('#prodRepository > .prod > .toolImg').eq(ref - 1).html();
		var lin = $('#prodRepository > .prod > .toolLink').eq(ln - 1).html();
		var it = "<div class='item' style='width:0px;'></div>";
		$('.toolbox').prepend(it);
		$('.item').eq(0).html(img);
		$('.modulLink').fadeOut('fast',function(){$('.modulLink').html(lin);$(this).fadeIn('slow');});
		$('.item').eq(0).animate({'width':'33%'});
		$('.item img').eq(1).animate({'width':'100%','margin-top':'0px'});
		$('.item img').eq(2).animate({'width':'50%','margin-top':'25px'});
		if(prodPrevCount == noi){prodPrevCount = 1;}else{prodPrevCount++;}
		}
	}
	

// reload Capacha
function reloadCapacha(curr){
		var newRand = (Math.floor(Math.random()*5))+1;
		if(newRand != curr){
			var newInp = '';
				newInp += "<img src='images/capcacha/random" + newRand + ".jpg' alt='capcacha' title='capcacha' />";
				newInp += "<input type='hidden' id='c1_F4' value='" + newRand + "' />";
				return $("#capachaP1").html(newInp);
			}else{
			reloadCapacha(curr);
			}
	
	}


// Mehle Scrolling
function goToByScroll(id){$('html,body').animate({scrollTop: $("#anchor"+id).offset().top},'slow');}
	
// Suche
function searchPage(para,str){
	$('.content').animate({'opacity':'0.2'},'slow',function(){
		$('.searchLoader').fadeIn('fast');
		$.ajax({
			type: "POST",
			url: "ajax/search.php",
			data: "para=" + para + "&str=" + str,
			success: function(response){
				var parts = response.split('|');
				if(parts[1] == 0){
					$('.searchLoader').fadeOut('slow',function(){
						$('.content').animate({'opacity':'1.0'},'fast',function(){$('#searchInfo').html("keine Ergebnisse!");});});
					}else{
					$('.searchLoader').fadeOut('slow',function(){
						$('.content').html("<span style='float:left;margin-left:25px;width:50%;margin-top:50px;font-size:19px;'>Für den Begriff <b>\"" + parts[2] + "\"</b> wurden <b>" +  parts[1] + "</b> Ergebnisse gefunden!</span>" + "<img style='float:right;' src='images/theme/suche.jpg' />" + parts[0]);
						$('.content').animate({'opacity':'1.0'},'slow',function(){$('#searchInfo').html("");});});
						}
				}
			});
		});
	}

