$(function(){
    initSlideNav(); 
//    clearFormFields({
//        clearInputs: true,
//        clearTextareas: true,
//        passwordFieldText: true,
//        addClassFocus: "focus",
//        filterClass: "default"
//    });
});

/* SlideNav */
function initSlideNav(){
	var z_index = 100;
	var _speed = 300;
	var hoverClass = 'hover';
	$('#nav li').each(function(){
		var hold = $(this);
		var drop_wrapper = hold.find('.drop').eq(0);
		var drop = hold.find('.drop-wrap').eq(0);
		if($.browser.msie && $.browser.version<7){
			hold.mouseenter(function(){
				hold.addClass(hoverClass);
			}).mouseleave(function(){
				hold.removeClass(hoverClass);
			});
		}
		if(drop_wrapper.length && drop.length){
			drop_wrapper.css({
				display: 'block'
			});
			var drop_wrapper_H = drop_wrapper.outerHeight(true);
			drop.css({
				marginTop: - drop_wrapper_H
			});
			drop_wrapper.css({
				height: 0,
				overflow: 'hidden'
			});
			hold.mouseenter(function(){
				hold.css('position','relative');
				drop_wrapper.stop().animate({height:drop_wrapper_H}, {queue:false, duration: _speed});
				drop.stop().animate({marginTop:0}, {queue:false, duration: _speed});
			}).mouseleave(function(){
				drop_wrapper.stop().animate({height:0}, {queue:false, duration: _speed});
				drop.stop().animate({marginTop:-drop_wrapper_H}, {queue:false, duration: _speed});
			});
		}
	});
}

//function clearFormFields(o)
//{
//	if (o.clearInputs == null) o.clearInputs = true;
//	if (o.clearTextareas == null) o.clearTextareas = true;
//	if (o.passwordFieldText == null) o.passwordFieldText = false;
//	if (o.addClassFocus == null) o.addClassFocus = false;
//	if (!o.filter) o.filter = "default";
//	if(o.clearInputs) {
//		var inputs = document.getElementsByTagName("input");
//		for (var i = 0; i < inputs.length; i++ ) {
//			if((inputs[i].type == "text" || inputs[i].type == "password") && inputs[i].className.indexOf(o.filterClass)) {
//				inputs[i].valueHtml = inputs[i].value;
//				inputs[i].onfocus = function ()	{
//					if(this.valueHtml == this.value) this.value = "";
//					if(this.fake) {
//						inputsSwap(this, this.previousSibling);
//						this.previousSibling.focus();
//					}
//					if(o.addClassFocus && !this.fake) {
//						this.className += " " + o.addClassFocus;
//						this.parentNode.className += " parent-" + o.addClassFocus;
//					}
//				}
//				inputs[i].onblur = function () {
//					if(this.value == "") {
//						this.value = this.valueHtml;
//						if(o.passwordFieldText && this.type == "password") inputsSwap(this, this.nextSibling);
//					}
//					if(o.addClassFocus) {
//						this.className = this.className.replace(o.addClassFocus, "");
//						this.parentNode.className = this.parentNode.className.replace("parent-"+o.addClassFocus, "");
//					}
//				}
//				if(o.passwordFieldText && inputs[i].type == "password") {
//					var fakeInput = document.createElement("input");
//					fakeInput.type = "text";
//					fakeInput.value = inputs[i].value;
//					fakeInput.className = inputs[i].className;
//					fakeInput.fake = true;
//					inputs[i].parentNode.insertBefore(fakeInput, inputs[i].nextSibling);
//					inputsSwap(inputs[i], null);
//				}
//			}
//		}
//	}
//	if(o.clearTextareas) {
//		var textareas = document.getElementsByTagName("textarea");
//		for(var i=0; i<textareas.length; i++) {
//			if(textareas[i].className.indexOf(o.filterClass)) {
//				textareas[i].valueHtml = textareas[i].value;
//				textareas[i].onfocus = function() {
//					if(this.value == this.valueHtml) this.value = "";
//					if(o.addClassFocus) {
//						this.className += " " + o.addClassFocus;
//						this.parentNode.className += " parent-" + o.addClassFocus;
//					}
//				}
//				textareas[i].onblur = function() {
//					if(this.value == "") this.value = this.valueHtml;
//					if(o.addClassFocus) {
//						this.className = this.className.replace(o.addClassFocus, "");
//						this.parentNode.className = this.parentNode.className.replace("parent-"+o.addClassFocus, "");
//					}
//				}
//			}
//		}
//	}
//	function inputsSwap(el, el2) {
//		if(el) el.style.display = "none";
//		if(el2) el2.style.display = "inline";
//	}
//}

//eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('9 t(a,b){g(3=0;3<a.h;3++){k c=[],d=[],n=[],e=[],4=[],l=[];8(a[3].5(\'.\')!=-1||a[3].5(\'#\')==-1){8(a[3].5(\'>\')!=-1){c[3]=a[3].f(a[3].5(\'>\')+2);a[3]=a[3].f(0,a[3].5(\'>\')-1)}8(a[3].5(\'.\')!=-1){d[3]=a[3].f(a[3].5(\'.\')+1);a[3]=a[3].f(0,a[3].5(\'.\'))}n[3]=a[3];8(!d[3])d[3]=\'\';8(c[3]){l[3]=r.o(n[3]);g(k j=0;j<l[3].h;j++){8(l[3][j].6.5(d[3])!=-1){4[3]=l[3][j].o(c[3]);g(k i=0;i<4[3].h;i++){4[3][i].p=9(){7.6+=\' \'+b};4[3][i].q=9(){7.6=7.6.m(b,\'\')}}}}}s{4[3]=r.o(n[3]);g(k i=0;i<4[3].h;i++){8(4[3][i].6.5(d[3])!=-1){4[3][i].p=9(){7.6+=\' \'+b};4[3][i].q=9(){7.6=7.6.m(b,\'\')}}}}}s 8(a[3].5(\'#\')!=-1){8(a[3].5(\'>\')!=-1){c[3]=a[3].f(a[3].5(\'>\')+2);a[3]=a[3].f(0,a[3].5(\'>\')-1)}a[3]=a[3].m(\'#\',\'\');e[3]=r.u(a[3]);8(e[3]){8(c[3]){4[3]=e[3].o(c[3]);g(k i=0;i<4[3].h;i++){4[3][i].p=9(){7.6+=\' \'+b};4[3][i].q=9(){7.6=7.6.m(b,\'\')}}}s{e[3].p=9(){7.6+=\' \'+b};e[3].q=9(){7.6=7.6.m(b,\'\')}}}}}}',31,31,'|||_hoverItem|_hoverElement|indexOf|className|this|if|function||||_class|_id|substr|for|length|||var|_parent|replace|_tag|getElementsByTagName|onmouseover|onmouseout|document|else|hoverForIE6|getElementById'.split('|'),0,{}));
//function ieHover() {
//	hoverForIE6(['ul.language > li'], 'hover');
//}
//if (window.attachEvent && !window.opera){
//    window.attachEvent("onload", ieHover);
//}

function showdropdown() {
    $("#languagedropdown").css({ display: 'block' });
}
function hidedropdown() {
    $("#languagedropdown").css({ display: 'none' });
}

function searchClick()
{
    document.location.href = 'http://de.testdsw.dk.dfds.root/pages/search.aspx?k=' + document.getElementById('searchinput').value;
}
function IsEnter()
{
 if(event.keyCode && event.keyCode == 13)
 searchClick();
}

function toggledropdown() {
    var lddl = document.getElementById('languagedropdown');
    (lddl.style.display == 'block') ? lddl.style.display = 'none' : lddl.style.display = 'block';
}
