	$(window).load(function(){
		//alert("loading completed! ");
		$('img#loaderImg').remove();
		$('#seitimage').show();	
		$('.slideshow').cycle({
		fx: 'fade',
		timeout: 5000,
		pause: 1,
		random:1,
		speed: 900
		// choose your transition type, ex: fade, scrollUp, shuffle, etc...
		});	
		$('#SubmitRFQ').hide();
	});
	$(document).ready(function () { 
	$('a.uihover').hover(
	function() { $(this).addClass('ui-state-hover'); }, 
	function() { $(this).removeClass('ui-state-hover'); }
	);
	$('#sendweb, #senddoc').show();
	$('#sendweb').click(function() {
		document.forms['sendRFQ'].action = '../../jquery/php/processRFQ.php';
        document.forms['sendRFQ'].target = '_blank';
        document.forms['sendRFQ'].submit()
	});
	
	$('#closeErrorID').click(function() {
		$('#EmailError').slideUp();
	});
	if(document.cookie){
	//	alert(document.cookie);
		var cokie = document.cookie.split(';');		
		if (cokie[0]=='head=large') {
			$('#head, #seitimage').show();	
			$('#uphead').hide();
		}
		if (cokie[0]=='head=small') {
			$('#head, #seitimage').hide();	
			$('#uphead').show();
		}
		if (cokie[0]=='') {
			$('#head, #seitimage').show();	
			$('#uphead').hide();
		}
	} else {
		var ablauf = new Date();				
		ablauf = new Date(ablauf.getTime() +1000*60*30);
		document.cookie = 'head=large; expires='+ablauf.toGMTString()+'; path=/'; 
		document.cookie = 'dialog=show; expires='+ablauf.toGMTString()+'; path=/'; 
		$('#head, #seitimage').show();	
		$('#uphead').hide();
	}
    $("#head").click(function () {  
			var ablauf = new Date();
			var cokie = document.cookie.split(';');	
			if (cokie[1]==' dialog=show') {
				$('#headnotice').dialog('open'); 
			}
			$('#head, #seitimage').slideUp("fast");	
			$('#uphead').slideDown("slow");						
			ablauf = new Date(ablauf.getTime() +1000*60*30);
			document.cookie = 'head=small; expires='+ablauf.toGMTString()+'; path=/'; 
	});
	$("#uphead").click(function () {  
			var cokie = document.cookie.split(';');	
			var ablauf = new Date();
			if (cokie[1]==' dialog=show') {
				$('#headnotice').dialog('open'); 
			}
			$('#uphead').slideUp("fast").toggle();	
			$('#head, #seitimage').slideDown("slow").toggle();						
			var ablauf = new Date(ablauf.getTime() +1000*60*30);
			document.cookie = 'head=large; expires='+ablauf.toGMTString()+'; path=/'; 
	});
	$('input#noshow').click(function() {
		var ablauf = new Date();
		if ($('input#noshow').attr('checked')) {
			var ablauf = new Date(ablauf.getTime() +1000*60*30);
			document.cookie = 'dialog=hide; expires='+ablauf.toGMTString()+'; path=/'; 
			//alert(document.cookie);
		} else {
			ablauf = new Date(ablauf.getTime() +1000*60*30);
			document.cookie = 'dialog=show; expires='+ablauf.toGMTString()+'; path=/';
			//alert(document.cookie);		
		}
	});
	$('#tabs').tabs();
	$('#closemsg').click(function() {
		$('#result').slideUp("fast");
	});
	var lng = $('#lang').val();
	if (lng =='de') {
		//alert('deute datepicker '+lng);
    $('.datepicker').datepicker({
     //   showOn: 'button',
        minDate: '-1M',
        maxDate: '+4Y',
		closeText:"Fertig",
		prevText:"Einen Monat zurück",
		nextText:"Einen Monat vor",
		currentText:"Heute",
		monthNames:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],
		monthNamesShort:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],
		dayNames:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],
		dayNamesShort:["Son","Mon","Die","Mit","Do","Fri","Sam"],
		dayNamesMin:["So","Mo","Di","Mi","Do","Fr","Sa"],
		dateFormat:"yy-mm-dd",
		firstDay:1
    });
} else {
	//alert('englich datepicker '+lng);
	    $('.datepicker').datepicker({
     //   showOn: 'button',
        minDate: '-1M',
        maxDate: '+4Y',
		closeText:"Done",
		prevText:"One month back",
		nextText:"One month forward",
		currentText:"Today",
		monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],
		monthNamesShort:["Jan","Feb","Mar","Apr","Mai","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],
		dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],
		dayNamesShort:["Sun","Mon","Tue","Wed","Tur","Fri","Sat"],
		dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],
		dateFormat:"yy-mm-dd",
		firstDay:1
    });
}
    $('a.JQbutton').hover(function () {
        $(this).addClass('ui-state-hover')
    },

    function () {
        $(this).removeClass('ui-state-hover')
    });
	$('input.fieldSm, input.field, select, textarea').focus(function(){
		$(this).addClass('inputactive').fadeIn("slow");
	});
	$('input.fieldSm, input.field, select, textarea').blur(function(){
		$(this).removeClass('inputactive');
	});
	$('#closemsg').click(function(){
	$("#result").slideUp();
	});
    $('#headnotice').dialog({
        autoOpen: false,
        modal: true,
        resizable: true,
        bgiframe: true,
		buttons: { "Ok": function() { $(this).dialog("close"); } }
    })
	$('#acckeys_dialog').dialog({
        autoOpen: false,
        modal: true,
        resizable: true,
        bgiframe: true,
		width: 600,
		height: 600,
		buttons: { "Ok": function() { $(this).dialog("close"); } }
    })
	$('#senddoc').click(function() {
		$('#printnotice').dialog('open');
		return false;
	});
	$('#printnotice').dialog({
			autoOpen: false,
			modal: true,
			resizable: true,
			bgiframe: true,
			width: 450,
			height: 280,
			buttons: {
						"Print RFQ now": function() { 
							document.forms['sendRFQ'].action = '../../jquery/php/processRFQdoc.php';
        					document.forms['sendRFQ'].target = '_blank';
        					document.forms['sendRFQ'].submit(); 
							$(this).dialog("close");
						}, 
						"Close": function() { 
							$(this).dialog("close"); 
						} 
					}		
			});
	$('#acckeys_open').click(function(){
		$('#acckeys_dialog').dialog('open');
		return false;
	});
});
$('#resulttxt a').click(function() {
			$('#result').slideup()
});
$("a.newWin").click(function () {
    window.open(this.href, '', 'toolbar=no,scrollbars=yes,resizable=yes,location=no,status=no');
    return false
});
function closewin() {
    if (window.opener) {
        window.opener.focus();
        window.close()
    } else {
        window.close()
    }
}
function sendform(id, param) {
    if (param == 'send') {
        document.forms[id].submit()
    }
}
function MM_openBrWindow(theURL, winName, features) {
    window.open(theURL, winName, features)
}
function AddNewLine(flag) {
    if (document.getElementById('anzahlartikel').value <= 1 && flag == 'weniger') {
        alert('Es sollten wenigestens ein Produkt geliefert werden :)');
        return
    }
    if (flag == 'mehr') {
        document.forms['sendRFQ'].action = '';
        document.forms['sendRFQ'].target = '';
        var an = document.getElementById('anzahlartikel').value * 1 + 1;
        document.getElementById('anzahlartikel').value = an;
        document.forms['sendRFQ'].submit()
    }
    if (flag == 'weniger') {
        an = document.getElementById('anzahlartikel').value;
        var i = window.confirm('Die Daten in Pos. ' + an + ' gehen verloren! Weiter ?');
        if (i) {
            document.forms['sendRFQ'].action = '';
            document.forms['sendRFQ'].target = '';
            an = an * 1 - 1;
            document.getElementById('anzahlartikel').value = an;
            document.forms['sendRFQ'].submit()
        }
    }
}
function setdatatobilnd() {
    document.forms['sendRFQ'].action = '';
    document.forms['sendRFQ'].target = '';
    document.forms['sendRFQ'].submit()
}
function NewSize(x, y) {
    window.resizeTo(x, y)
}
function settrigger(flag, id) {
    if (flag != 'submit') {
        document.getElementById('refrescher').value = 1;
        document.getElementById(id).value = 1;
        document.forms['findprod'].action = '';
        document.forms['findprod'].target = '';
        document.forms['findprod'].submit()
    } else {
        document.getElementById('refrescher').value = 0;
        document.forms['findprod'].submit()
    }
}
function setCheckedValue(radioObj, newValue) {
    if (!radioObj) return;
    var radioLength = radioObj.length;
    if (radioLength == undefined) {
        radioObj.checked = (radioObj.value == newValue.toString());
        return
    }
    for (var i = 0; i < radioLength; i++) {
        radioObj[i].checked = false;
        if (radioObj[i].value == newValue.toString()) {
            radioObj[i].checked = true
        }
    }
}
function fillform() {
	document.getElementById('UserVorname').value = 'Daniel';
	document.getElementById('UserName').value = 'Körtvélyessy';
	document.getElementById('UserTelefon').value = '+493040586940';
	document.getElementById('UserFax').value = '+493040586941';
	document.getElementById('UserEmail').value = 'daniel.koertvelyessy@thermo-control.com';
	document.getElementById('UserPassWrd').value = '0011';
	document.getElementById('UserPassWrdCheck').value = '0011';
	document.getElementById('UserFirma').value = 'thermo-control GmbH';
	document.getElementById('UserAbteilung').value = 'Einkauf';
	document.getElementById('UserStrasse').value = 'Grünspechtweg 19';
	document.getElementById('UserPLZ').value = '13469';
	document.getElementById('UserOrt').value = 'Berlin';
	document.getElementById('UserVAT').value = 'DE1205021';
	document.getElementById('UserStrNr').value = '3721548';
	document.getElementById('UserGroup').selectedIndex = 2;
	document.getElementById('UserTitel').selectedIndex = 2;
}
