function init(){ var a=document.getElementsByTagName('a'); for (var i=0;i<a.length;i++) { a[i].onmousedown = function(){ this.onfocus = function(){this.blur();} }
      a[i].onmouseup = function(){ this.onfocus = function(){} }
	  a[i].onmouseout = a[i].onmouseup;
} }; window.onload = init;

		
$(document).ready(function(){
	
	$('.meta > li:last > .btn > a').css({ 'font-weight':'bold' });
	$('.ttip').tinyTips('title');
	baseurl = 'http://www.hairfree.com/';
	
	// Windowsize modifications - set openvalues
	rootWin = $(window);
	rootWinOpenWidth = rootWin.width();
	rootWinOpenHeight = rootWin.height();	
	calcAdd = 0; // wird zur kalkulierten % addiert damit der verkleinungseffekt nicht so extrem ist
	
	// Layout bestview
	lbvHeight = 780; 
	lbvWidth =	1024;
	
/***************************
 * Funktionen 
 ***************************/

    function mergeStr(Str){
		arg=[];
        for(i=0;i<Str.length;i++){
            sub=Str.substr(i,1);
            if(sub!=" "){
                arg.push(sub)
            };
        }
        newStr=arg.join("");
        return newStr;
    }
	
	function checkplayerstop(cntlayerObj){
		if ($('iframe',cntlayerObj).size() > 0) {			
			$('iframe',cntlayerObj).api("api_pause");
		}		
	}	

	function setHeightWidth($element, $height, $width){
		if ($element.size() > 0) {
			if ($height != '') 
				$element.css({
					height: $height
				});
			
			if ($width != '') 
				$element.css({
					width: $width
				});
		}
	};

	function calcViewSize(){	
		this.height = rootWin.height() * 100 / lbvHeight;
		this.width = rootWin.width() * 100 / lbvWidth;
		
		this.height = this.height + calcAdd;
		
		//alert(this.height);
		
		if (this.height >= 105) {
				this.height = 105;
		}
		
		return this.height;
	}
	
	function setCntlayer(){
		if ($('.cntlayer').size() > 0) {
			navwidth = $('ul.navigation').width();
			$('.cntlayer').css({
				width: navwidth-5
			});

			setHeightWidth($('.cntlayer:visible').find('.col1'), '', parseInt($('.cntlayer').width()) - (290 + 30 + 60 + 10));
			$('.newbox-shadow > .newbox-cnt','.cntlayer').height($('.newbox > .newbox-cnt','.cntlayer').height());
		}
	}
	
	function setInitial(){
		$('html').css({'font-size': calcViewSize()+'%' });
		
		headHeight = $('.foot').height();
		setHeightWidth($('.overlay'), rootWin.height(), '');
		setHeightWidth($('.epaperwrap'), rootWin.height() - (headHeight * 2),'');
		
		cntlayerpos4popup = headHeight - 20;
			
		if ($('.cntlayer:visible').size() > 0) {
			setHeightWidth($('.opac'), rootWin.height(), '');
		} else {
			setHeightWidth($('.opac'), rootWin.height() - (headHeight), '');
		}	
		
		setCntlayer();	
				
	}
	
	function checkOverlay(){
		// ist ein overlay da ? wenn nein bau einen
		if ($('.overlay').size() == 0) 
			$('.head').after('<div class="overlay">&nbsp;</div>');
						
		// ist ein aktiver overlay da ? wenn nein dann aktiviere ihn
		if ($('.overlay.act').size() == 0) {
			$('.overlay').fadeTo('fast',0.6).addClass('act');
			$('.foot').css('z-index', 90);
			//$('.foot').css({'z-index': 80});
		}			

		$('.overlay').bind("click",function(){
		
			if ($('.cntlayer:visible').size() > 1) {
				$('.cntlayer:last').animate({
					top: parseInt($('.cntlayer:first').css("top")),
					right: parseInt($('.cntlayer:first').css("right"))
				}, 800, function(){
					$('.cntlayer:last > .cntwrap').removeClass('dark');
				});
							
				$('.cntlayer:last').fadeOut('500',function(){
					if ($('.cntlayer:visible').size() == 0)
						$('.overlay.act').fadeOut(500,function(){
							$(this).removeClass('act');
						});			
				});				
			}
			
			$('.cntlayer').fadeOut('500',function(){
				if ($('.cntlayer:visible').size() == 0) {
					$('.overlay.act').fadeOut(500, function(){
						$(this).removeClass('act');
						$('.opac').css('height',parseInt($(".body").height()) + 120);
						$('.foot').css('z-index', 120);
						if ($('.teaserbox-ffinder').size() > 0) {
							$('.teaserbox-ffinder').css({
								'z-index': '131'
							});
							$('.teaserbox-tellfriend').css({
								'z-index': '130'
							});
						}	
						$('.hinweis').add('.smedia').css({
							'z-index': '131'
						});								
						if ($('.AQloaded').size() != 0) {				
							$('.AQloaded').remove();
						}	
					});
				}
			}).addClass('hidden');;
			
		});			
	}
/***************************
 * Initial settings 
 ***************************/
	if ($('.kdepr').size() != 0) {
		
		if ($(document).getUrlParam("kennstDuEinenSemTracking") != null) {
      $(".fi-kb-tel").each(function(){
      
        splitdeli = $(this).text().indexOf(':');
        tellabel = $(this).text().substr(0, splitdeli);
        if(splitdeli > 0)
          $(this).text(tellabel + ': ' + $('.kdepr').text());
        else
          $(this).text($('.kdepr').text());
      });
		}
	}
	
	setInitial();	
			
	// columnsize in bodycnt
	if ($('.col1','.bodycnt').size() > 0) {	
		if($('.col2','.bodycnt').size() > 0)
			col2width = 442; //430
		else
			col2width = 0;
		
		$('.bodycnt > .col1').width(rootWinOpenWidth - 120 - col2width - 40).parent().css({ // -(abs. links rechts) -(col2) -(abs. spalten)
			width: $('.bodycnt > .col1').width() + $('.bodycnt > .col2').width() + 45
		});
	}else {
		$('div.body > .bodycnt').css({
			height: $('div.body > .bodycnt').height(),
			'top': (rootWin.height()/2 - $('div.body > .bodycnt').height()/2)+10
		});
	}
	
	// columnsize in institutfinder
	$('.col2','.tx-thinstitutfinder-pi1').css({
		width: rootWin.width() - 494 - 120 - 45
	});

	if (rootWinOpenWidth <= 1100) {		
		$('.col2','.tx-thinstitutfinder-pi1').css({
			width: 430
		});		
	}
	
/***************************
 * Resize settings 
 ***************************/	
	$(window).resize(function(){
		
		setInitial();
		
		// renew columnsize in bodycnt
		if ($('.col1','.bodycnt').size() > 0) {	
			if($('.col2','.bodycnt').size() > 0)
				col2width = 442; //430
			else
				col2width = 0;
			
			$('.bodycnt > .col1').width(rootWin.width() - 120 - col2width - 40).parent().css({ // -(abs. links rechts) -(col2) -(abs. spalten)
				width: $('.bodycnt > .col1').width() + $('.bodycnt > .col2').width() + 45
			});
		}else {
			$('div.body > .bodycnt').css({
				'top': (rootWin.height()/2 - $('.bodycnt').height()/2)+10
			});
		}
		
		
		
		$('.col2','.tx-thinstitutfinder-pi1').css({
			width: rootWin.width() - 494 - 120 - 40
		});
			
		// cntlayer width and cntlayer col width
		if(rootWin.width() <= 1200){
			// position and width for layer (cntlayer)		
			$('.col2','.tx-thinstitutfinder-pi1').css({
				width: 430
			});				
		} else {
			// position and width for layer (cntlayer)		
			$('.col2','.tx-thinstitutfinder-pi1').css({
				width: rootWin.width() - 494 - 120 - 40
			});	
		}
	});

/***************************
 * Teaser fading magic 
 ***************************/	

	if($('.body > .fadeitem').size() > 1){
		$('.body > .fadeitem:first').show();
		itemCount = $('.body > .fadeitem').size();
		slideshowList = $('.body');
		function fadeItem(nextIndex,currIndex,option){	
			
			slideshowList.children("div.fadeitem:eq(" + nextIndex + ")").css({
				'z-index': 5
			}).show();
			
			slideshowList.children("div.fadeitem:eq(" + currIndex + ")").css({
				'z-index': 10
			}).fadeOut('slow');
							
			if(option == "auto"){
				currIndex = nextIndex;
				nextIndex = currIndex + 1;
				
				if (nextIndex == itemCount) {
					currIndex = nextIndex - 1;
					nextIndex = 0;
				}
				
				setTimeout(function(){
					fadeItem(nextIndex, currIndex, "auto");
				}, 4000);		
			}		
		}
		setTimeout(function(){
			fadeItem(1,0,"auto");
		}, 5000);		
	}

/***************************
 * Selectfield
 ***************************/	

	$("ul.select > li.parent").click(function(){$(this).children("ul").show();});	
	$("ul.value").mouseleave(function(){$(this).hide();});
	$("ul.value > li:last-child").css("border", "none"); 
	
/***************************
 * Institutsfinder
 ***************************/	
	function if_getnewdata(){
		ffiUrl = $('#ffinder-form').attr('action');
		fiSword = $('.ffinder-sword-text',$('#ffinder-form')).val();
		fiCountry = $('.ffinder-sword-uland',$('#ffinder-form')).val();
		long = $('.ffinder-sword-long',$('#ffinder-form')).val();
		lat = $('.ffinder-sword-lat',$('#ffinder-form')).val();
		locid = $('.ffinder-sword-locid',$('#ffinder-form')).val();
		
		searchString = {"ffisearch":[{ "sword": fiSword ,"country": fiCountry ,"long": long ,"lat": lat,"locid": locid}]};	
		fiSwordesc = escape(fiSword);
		dataString = JSON.stringify(searchString);	
		
		function showResult(res){
			$(".ffinder-result-list > tbody").html("");
					
			var obj = $.parseJSON(res);
			
			if (obj != null) {	
				$('.ffinder-result > h1 > span').html(obj.length);
				
				$.each(obj, function(){

				    if(!this.nav_title)
						linktitle = this.title;
					else
						linktitle = this.nav_title;
						
					speakUrl = baseurl + 'institute/' + mergeStr(linktitle) + '/'; //?fis=' + fiSwordesc + '&c=' + fiCountry
		
					output = '';
						output += '<tr>';
						output += '<td class="ffinder-result-list-plz"><span><a href="' + speakUrl +'">' + this.postcode + '</a></span></td>';
						output += '<td class="ffinder-result-list-city"><span><a href="' + speakUrl +'">' + this.city + '</a></span></td>';
						output += '<td class="ffinder-result-list-holder"><span><a href="' + speakUrl +'">' + this.street + '</a></span></td>';
						output += '<td class="ffinder-result-list-phone"><span><a href="' + speakUrl +'">' + this.phone + '&nbsp;</a></span></td>';
						output += '<td class="ffinder-result-list-detail"><span class="ui-state-default"><a class="ui-icon ui-icon-search" href="' + speakUrl +'">&nbsp;</a></span></td>';
						output += '</tr>';
						$(".ffinder-result-list > tbody").append(output);
				});
				$('.ffinder-result-list > tbody > tr > td > span').bind("mouseenter mouseleave",function(e){
					if(e.type == 'mouseenter')
						$(this).parent().parent().addClass('act');
					else
						$(this).parent().parent().removeClass('act');
				});					
			}
		}
					
		$.post(
			ffiUrl,
			{data: dataString}, 
			showResult,
			"text"
		);		
	};
  
	$('#ffinder-form').submit(function(e){
		e.preventDefault();
		if ($('#ffinder-sword-text-01').val() != "") {if_getnewdata();}
	});
  
	$('.ffinder-sword-submit').click(function(e){
		e.preventDefault();
		if ($('#ffinder-sword-text-01').val() != "") {if_getnewdata();}
	});	
	
	$('.ffinder-cselect > div.box').click(function(){
		$('.ffinder-cselect > div.act').removeClass('act');
		$(this).toggleClass('act');
		
		$('.ffinder-result').attr('id',$(this).attr('id').toLowerCase()+'-act');
		//$('#ffinder-sword-text-02').attr('value',$(this).attr('id').toUpperCase());
		$('#ffinder-sword-text-02').val($(this).attr('id').toUpperCase());
	});

	
/***************************
 * contentlayer magic
 ***************************/	
	
	//if there's another contentlayer
	if ($('.cntlayer').size() > 1) {
		$('body > .cntlayer:not(:first)').hide();
	}
	$('.overlay').bind("click",function(){
		
		if ($('.cntlayer:visible').size() > 1) {
			$('.cntlayer:last').animate({
				top: parseInt($('.cntlayer:first').css("top")),
				left: parseInt($('.cntlayer:first').css("left"))
			}, 800, function(){
				$('.cntlayer:last > .cntwrap').removeClass('dark');
			});
						
			$('.cntlayer:last').fadeOut('500',function(){
				if ($('.cntlayer:visible').size() == 0)
					$('.overlay.act').fadeOut(500,function(){
						$(this).removeClass('act');
					});			
			});				
		}
		
		$('.cntlayer').fadeOut('500',function(){
			if ($('.cntlayer:visible').size() == 0) {
				$('.overlay.act').fadeOut(500, function(){
					
					$(this).removeClass('act');
					$('.opac').css('height',parseInt($(".body").height()) + 120);
					$('.foot').css('z-index', 120);
					if ($('.teaserbox-ffinder').size() > 0) {
						$('.teaserbox-ffinder').css({
							'z-index': '131'
						});
						$('.teaserbox-tellfriend').css({
							'z-index': '130'
						});
					}	
					
					$('.hinweis').add('.smedia').css({
						'z-index': '131'
					});							
				});
			}
		}).addClass('hidden');;
		
	});
	
	$('a.openlayer').bind('click',function(e){
		e.preventDefault();
					
		cntLayertoOpen = $(this).attr('rel');
		cntLayerIndex = parseInt($('div.cntlayer').index(document.getElementById(cntLayertoOpen)));		

		$('.foot').css('z-index', 90);
		
		if ($('.teaserbox-ffinder').size() > 0) {
			$('.teaserbox-ffinder').css({
				'z-index': '91'
			});
			$('.teaserbox-tellfriend').css({
				'z-index': '90'
			});
		}
		
		$('.hinweis').add('.smedia').css({
			'z-index': '90'
		});	
		
		checkOverlay()
		
        $('html, body').animate({scrollTop:0}, 'fast');
		
		// ist da ein contentlayer ohne hidden ?
		if($('body > .cntlayer:visible').size() == 0){
			
			// wenn "nein" Ziel öffnen	
			//$('.cntlayer#'+cntLayertoOpen).css({ top: -cntlayerpos4popup }); //-8em
			$('.cntlayer#'+cntLayertoOpen).fadeIn(function(){
				$(this).removeClass('hidden');
				$('.opac').height(parseInt($(".body").height())+240);
				$('.newbox-shadow > .newbox-cnt',this).height($('.newbox > .newbox-cnt',this).height());
			});	
			
		} else{
			
			// wenn "ja" position abgreifen und auf -11 -30 animieren
			lastLayerOpendTop = parseInt($('body > .cntlayer:visible').css('top'));
			lastLayerOpendRight = parseInt($('body > .cntlayer:visible').css('right'));
			$('body > .cntlayer:visible').addClass('dark');
			
			$('.cntlayer#'+cntLayertoOpen).fadeIn('fast',function(){
				$('.cntlayer#' + cntLayertoOpen).animate({
					top: lastLayerOpendTop-11,
					right: lastLayerOpendRight+30
				}, 800).removeClass('hidden');		
				$('.newbox-shadow > .newbox-cnt',this).height($('.newbox > .newbox-cnt',this).height());		
			});					
		}
		setCntlayer();
		if ($('iframe','.cntlayer#'+cntLayertoOpen).size() > 0) {
			$('.overlay').bind("click", function(){
				vimeoplayer = $('iframe','.cntlayer#'+cntLayertoOpen).get(0);
				vimeoplayer.api("api_pause");
			});
		}	
		
	});
	
	$('a.newbox-close','.cntlayer').bind("click",function(e){
		e.preventDefault();
		
		tmpCntWinClose = $(this);
		tmpCntWin = $(this).parent().parent();
		
		if ($('.cntlayer:visible').size() > 1) {
			tmpCntWin.animate({
				top: parseInt($('.cntlayer:first').css("top")),
				right: parseInt($('.cntlayer:first').css("right")
			)}, 800, function(){
				$('.cntlayer:first > .cntwrap').removeClass('dark');
			});
		}
	
		tmpCntWin.fadeOut('500',function(){
			if ($('.cntlayer:visible').size() == 0)
				$('.overlay.act').fadeOut(500,function(){
					
					$(this).removeClass('act');
					$('.opac').css('height',parseInt($(".body").height()) + 120);	
					$('.foot').css('z-index', 120);
	
					if ($('.teaserbox-ffinder').size() > 0) {
						$('.teaserbox-ffinder').css({
							'z-index': '131'
						});
						$('.teaserbox-tellfriend').css({
							'z-index': '130'
						});
					}	
					
					$('.hinweis').add('.smedia').css({
						'z-index': '131'
					});			  
  				
				});		
		}).addClass('hidden');
		
		if ($('iframe',tmpCntWin).size() > 0) {
			vimeoplayer = $('iframe',tmpCntWin).get(0);
			vimeoplayer.api("api_pause");
		}			
		
	});

/***************************
 * box magic, flying boxes
 ***************************/

	if ($(".boxlist").size() > 0 && $(".cntlayer").size() == 0) {	
		boxlist = $(".boxlist");
		

		
		if (!boxlist.hasClass('stop')) {

			$('.boxlist > br').remove();
			$('.boxlist > .box:eq('+ Math.ceil(boxlist.children('.box').size()/2) +')').before('<br />');
		
			boxlistoffset = boxlist.offset().top;
			boxlist.children().each(function(){
				elepos = $(this).offset();
				$(this).data({
					"x": elepos.left - 60,
					"y": elepos.top - boxlistoffset
				}).css({
					top: elepos.top - boxlistoffset,
					left: -(elepos.left + 150)
				});
			});
			
			anzBoxes = $(".box", boxlist).size() - 1;
			
			function loopFlyBox(BoxArray, BoxIndex){
				if (BoxArray[BoxIndex]) {
				
					// animate				
					$(BoxArray[BoxIndex]).css({
						position: "absolute",
						display: "block"
					}).animate({
						left: $(BoxArray[BoxIndex]).data('x')
					}, 800);
					
					// call again
					setTimeout(function(){
						loopFlyBox(BoxArray, BoxIndex - 1);
					}, 200);
				}
			}
			loopFlyBox($(".box", boxlist), anzBoxes);
		}
	}	
	
/***************************
 * navigation magic
 ***************************/

	var last,id;
	$('.btn').each(function(){
		link = $(this).children('a');
		shadow = $(this).children('.sh');
		
		tmpcntLink = link.children('span:first').text();
		tmpcntShadow = shadow.children('span:first').text();
		
		link.children('span:first').remove();
		shadow.children('span:first').remove();
		
		link.children('span').before(tmpcntLink);
		shadow.children('span').before(tmpcntShadow);
	});
	
	$('.btn','.sub').bind("mouseenter mouseleave",function(e){
		if(e.type == "mouseenter")
			$(this).parent().addClass('act');
		else
			$(this).parent().removeClass('act');
	});
	
	$("ul.navigation > li").bind("mouseenter mouseleave",function(e){
		//caching
		$actEl = $(this);
		$nav = $(this).parent();
		$opac = $(this).children(".opac");
		$sub = $(this).children(".sub");
		
		//heights
		$subHeightMin = 1.17; //14;
		$subHeightAct = 7.8; //94;
		
		if ($nav.hasClass('meta')) {
			$subHeightMin = 1.17;
			$subHeightAct = 8; //9.2;
		}
		
		$subHeightMax = ($sub.children("ul").height()*0.084563758389) + 18; //149; //103 from top, padding from ul +36, nice space +10
		
		//magic	
		if (e.type == "mouseenter") {
			if ($actEl.attr('class') != 'act') {
				$actEl.addClass('open');
			}
			//--------------open--------------------
			if (!$actEl.data("last") || e.timeStamp - $actEl.data("last") >= 1600 ) {
				$opac.fadeTo("slow",0.5).next(".sub").delay(200).animate({
					height: $subHeightMax+'em'
				},{
					duration: 500,
				    easing: 'jswing'
				});
			
				if (!$actEl.hasClass("act")) {
					if ($nav.hasClass('meta')) {
						$sub.children(".glow").animate({bottom: 0},500);
					}else{
						$sub.children(".glow").animate({top: 0},500);	
					}	
				}	
			}
			//set timestamp
			$actEl.data("last", e.timeStamp)
			//----------------------------------
			
		} else if (e.type == "mouseleave") {
			if($actEl.attr('class') == 'open')
				$actEl.removeClass('open');	
			//--------------close--------------------
			if ($actEl.hasClass("act")) 
				$aH = $subHeightAct+'em'
			else 
				$aH = $subHeightMin+'em'
			
			$sub.animate({
				height: $aH
			},{
				duration: 500,
				easing: 'jswing'
			}).prev(".opac").delay(300).fadeOut(300);
			
			if (!$actEl.hasClass("act")) {
				if ($nav.hasClass('meta')) {
					$sub.children(".glow").animate({bottom: -100}, 500);	
				}else{
					$sub.children(".glow").animate({top: -100}, 500);
				}		
			}
			//----------------------------------
			
		}
		e.stopPropagation();		
	});

	$( "#accordion" ).accordion({
		autoHeight: false,
		active: false,
		collapsible: true
	});
	
	if (window.location.hash !="") {
		var hash = window.location.hash;
		var thash = hash.substring(hash.lastIndexOf('#'), hash.length);
		$('#accordion').find('a[href*=' + thash + ']').closest('h3').trigger('click');
	}
	
	$('.newbox-comb').delay(1000).each(function(){
		$('.newbox-shadow > .newbox-cnt',this).height($('.newbox > .newbox-cnt',this).height());
	});
	
	
	$('a.openajaxcnt').click(function(e){
		e.preventDefault();
		
		checkOverlay();
		
		if ($('.teaserbox-ffinder').size() > 0) {
			$('.teaserbox-ffinder').css({
				'z-index': '91'
			});
			$('.teaserbox-tellfriend').css({
				'z-index': '90'
			});
		}
		$('.hinweis').add('.smedia').css({
			'z-index': '90'
		});	
		OAloadURL = $(this).attr('href');
		
		if ($('.AQloaded').size() != 0) {
			$('.AQloaded').remove();
		}
				
		$('.body').before('<div class="AQloaded"></div>');
		$('.AQloaded').load(OAloadURL +' .loaditems',function(){
			
			$('.loaditems').attr({'id': OAloadURL});		
			
			$('html').scrollTop(0);
			$('.ttip').tinyTips('title');
							
			$('a.newbox-close','.cntlayer').bind("click",function(e){
				e.preventDefault();
				
				tmpCntWinClose = $(this);
				tmpCntWin = $(this).parent().parent();					
				
				if ($('.cntlayer:visible').size() > 1) {
					tmpCntWin.animate({
						top: parseInt($('.cntlayer:first').css("top")),
						right: parseInt($('.cntlayer:first').css("right")
					)}, 800, function(){
						$('.cntlayer:first > .cntwrap').removeClass('dark');
					});
				}
			
				tmpCntWin.fadeOut('500',function(){
					if ($('.cntlayer:visible').size() == 0)
						$('.overlay.act').fadeOut(500,function(){
							
							$(this).removeClass('act');
							$('.opac').css('height',parseInt($(".body").height()) + 120);	
							$('.foot').css('z-index', 120);
							if ($('.teaserbox-ffinder').size() > 0) {
								$('.teaserbox-ffinder').css({
									'z-index': '131'
								});
								$('.teaserbox-tellfriend').css({
									'z-index': '130'
								});
							}	
							$('.hinweis').add('.smedia').css({
								'z-index': '131'
							});						
							if ($('.AQloaded').size() != 0) {				
								$('.AQloaded').remove();
							}	
						});		
				}).addClass('hidden');			
			});
			
			setCntlayer();						
			setHeightWidth($('.cntlayer').find('.col1'), '', parseInt($('.cntlayer').width()) - (290 + 30 + 60 + 10));
			$('.loaditems > .cntlayer:eq(0)').fadeIn(function(){
				$(this).removeClass('hidden');
				$('.opac').height(parseInt($(".body").height())+240);
				$('.newbox-shadow > .newbox-cnt',this).height($('.newbox > .newbox-cnt',this).height());
			});	
				
										
		});
	
	});
	
	if ($(".rand").size() == 1) {
		
		instBulletAnz = $(".rand > ul > li").size();
			
		function randLi(){
			randNumber = Math.floor(Math.random()*instBulletAnz);
		
			if ( $(".rand > ul > li:eq(" + randNumber + "):visible").size() == 1 ) 
				randLi();
			else 
				$(".rand > ul > li:eq(" + randNumber + ")").show();	
		}	
		
		for (var i = 0; i <= 2; i++) {
			randLi();	
		}
	}
	
	setCntlayer();

	$("form.shortform input.norm").bind("click",function(){
		$(this).attr({value:""});
		$(this).css({color: "#7D7A78"});
		$(this).unbind('click');
	});	


	$( ".dialog-winform" ).dialog({
		autoOpen: false,
		draggable: true,
		height: 400,
		width: 320,
		resizable: false
	});
	$( ".winform-opener" ).click(function() {
		$( ".dialog-winform" ).dialog( "open" );
		return false;
	});
	
	if($('.instss').size() > 0)
		$('.instss').innerfade({ speed: 3000, timeout: 3000, type: 'random', containerheight: '300px' }); 

});

