﻿function inp1stclick(obj,txt){if(obj.value==txt)obj.value='';}
function inprestore(obj,txt){if(obj.value=='')obj.value=txt;}

function login(){
	var sLoginURL = $.ajax({
		url: HTTPSPrefix + "_adminorder/login.aspx?u=" + $('#txtUsername').val() + "&p=" + $('#txtPassword').val(),
		cache:false,
		async: false
	}).responseText;
	if (sLoginURL == ''){
		return '<div class="message"><h1>Login Failed</h1><p>Please try again or <a href="contact.aspx">Contact Us</a></div>';
	}
	else{
		window.location = sLoginURL;
	}
}

function forgotpasswordmsg(){
//	var sHTML = '<div class="message"><h1>Forgot password</h1><p>'

	return '<div class="message"><h1>Forgot password</h1><iframe src="_adminorder/forgotpasswordsend.aspx" width="570" height="100" frameborder="0" /></div>'

//	if ($('#txtUsername').val().indexOf("@") == -1){
//		sHTML += 'If you have forgotten your password, please close this window, enter your email address in the username field and click the "Haben Sie ihr Kennwort vergessen?" link again and we will send you an email with a new password.';
//	}
//	else{
//		sHTML += $.ajax({
//			url: HTTPSPrefix + "_adminorder/forgotpassword.aspx?u=" + $('#txtUsername').val(),
//			async: false
//		}).responseText;
//	}
//	return sHTML + '</p><p>If you are still unable to login, please <a href="contact.aspx">contact us</a>.</p></div>'
}

$(function(){
	$('.menu ul ul a').collapsor();
	$(".menu ul ul.defaultshow").show();
});

$(document).ready(function(){
	var clearMePrevious = '';
	$('.clearMeFocus').focus(function(){
		if($(this).val()==$(this).attr('title')){
			clearMePrevious = $(this).val();
			$(this).val('');
		}
	});
	$('.clearMeFocus').blur(function(){
		if($(this).val()==''){
			$(this).val(clearMePrevious);
		}
	});
});

$('.login input#txtPassword').live("keypress", function(e){
	if (e.keyCode == 13) csspop_pup('pup',login(), 102);
});

