var manager = {
	
	start:function(){	
	
		if($('loginform')) manager.modules.login.focus();
		if($('contact-seb')) manager.modules.contact.init();
	
	},
	
	modules:{
	
		login:{
		
			focus:function(){
				
				$('user_login').text =  $('user_login').value;
				$('user_login').onfocus = function(){if(this.value == this.text) this.value = '';}
				$('user_login').onblur = function(){if(this.value == '') this.value = this.text;}
				
				$('user_pass').text =  $('user_pass').value;
				$('user_pass').onfocus = function(){if(this.value == this.text) this.value = '';}
				$('user_pass').onblur = function(){if(this.value == '') this.value = this.text;}
			
			}
		
		},
		
		contact:{
			
			init:function(){
				
				$('contact-seb').onsubmit = function(){
					manager.modules.contact.chk();
					return false;
				}
			
			},
			
			chk:function(){
				
				var submit;
				
				if($('name').value == '' || $('email').value == '' || $('message').value == '') submit = false;
				else submit = true;
				
				if($('name').value == '') $('name').style.border = '1px solid darkred';
				else $('name').style.border = '1px solid #ccc';
				if($('email').value == '') $('email').style.border = '1px solid darkred';
				else $('email').style.border = '1px solid #ccc';
				if($('message').value == '') $('message').style.border = '1px solid darkred';
				else $('message').style.border = '1px solid #ccc';
				
				if(submit){
				
					var queryParam = $('contact-seb').toQueryString();
					queryParam += '&killcache=' + new Date().getTime();
					
					$('to-contact').innerHTML = '';
					$('to-contact').style.background = 'url(http://www.seoplayer.com/wp-content/themes/seoplayer/img/loader.gif) no-repeat center center';
					$('to-contact').style.height = '200px';
					
					var htmlURL = 'http://www.seoplayer.com/wp-content/themes/seoplayer/pages/seb_contact.php?killcache=' + new Date().getTime();
					var myRequest = new Request({url:htmlURL,onSuccess:function(){
						$('to-contact').style.background = '#FFFFFF';
						$('to-contact').style.textAlign = 'center';
						$('to-contact').innerHTML = this.response.text;
					}});
					
					myRequest.send({method:'post',data:queryParam});
				
				}
				
			}
		
		}
	
	}
};

window.addEvent('domready', manager.start);