function calculateChar(id,c){
		var txt = document.getElementById(id);
		var l = txt.value.length;		
		var s = document.getElementById(c);
		var d = 250-l;		
		if(d >= 0)
			s.value=d;
		if(txt.value.length > 250){
			txt.value=txt.value.toString().substring(0,250);
		}
	}


function init()
{
	var s = document.getElementsByTagName("input");
	
	addAttribute(s);
		
	 s = document.getElementsByTagName("textarea");
	 
	 addAttribute(s);
}

function addAttribute(s)
{
	if(s)
	{
		var i =0 ;
		for(;i<s.length;i++)
		{
			var t = s[i];
			
			if(t.type )
			
			if(!Prototype.Browser.IE)
			{
				t.setAttribute("onfocus","this.style.borderWidth='2px';");
				t.setAttribute("onblur","this.style.borderWidth='1px';");				
			}
			
			if(Prototype.Browser.IE)
			{
				t.onfocus = function(e)
				{
					this.style.borderWidth="2px";
				} 
				
				t.onblur = function(e)
				{
					this.style.borderWidth="1px";
				} 
				
			}
		} 
	}
	
}

Ajax.Responders.register({
  onCreate: function(){
   	var image = $('image');
   	image.style.display = 'block';
  }, 
  onComplete: function(){
   	var image = $('image');
   	image.style.display = 'none';   
  }
});

function send(id)
{
new Ajax.Request('http://www.e-ustam.com/register/dispatcher', 
	{
  		parameters: $(id).serialize(true),
  		requestHeaders :['Accept-Charset','utf-8'],
		onSuccess: function(transport){
      		var response = transport.responseText;
      		var em =  $('emptyspan')
      		
      		if(response == "success")
      		{
      			document.location = "http://www.e-ustam.com/register/sucess.jsp";
      		}
      		else if(response == "javasuccess")
      		{
      			document.location = "http://www.e-ustam.com/register/jsucess.jsp";
      		}
      		else if(response == "javasuccessEn")
      		{
      			document.location = "http://www.e-ustam.com/register/jsucess_en.jsp";
      		}
      		else
      		{
      			em.innerHTML = response;	
      		}
      		
    	}
 	});
	
}

function sendSeminer(id)
{
new Ajax.Request('http://www.e-ustam.com/register/seminer', 
	{
  		parameters: $(id).serialize(true),
  		requestHeaders :['Accept-Charset','utf-8'],
		onSuccess: function(transport){
      		var response = transport.responseText;
      		var em =  $('emptyspan')
      		
      		if(response == "success")
      		{
      			document.location = "http://www.e-ustam.com/register/ssucess.jsp";
      		}
      		else
      		{
      			em.innerHTML = response;	
      		}
      		
    	}
 	});
	
}


window.onload=init;

