var countNewsletterField = 0;
var countSendToAFriendField = 0;            
function bindAlreadyClient()
{
Event.observe($('alreadyClient'), 'submit', alreadyClientManage,false);     
}
function bindNewClient()
{
Event.observe($('newClient'), 'submit', newClientManage,false);             
}
function bindNewRecipient()
{
Event.observe($('newRecipient'), 'submit', newRecipientManage,false);     
}
function bindNewContact()
{
Event.observe($('newContact'), 'submit', newContactManage,false);     
}
function bindNewQuote()
{
Event.observe($('newQuote'), 'submit', newQuoteManage,false);     
}
function bindNewNewsletter()
{
Event.observe($('newNewsletter'), 'submit', newNewsletterManage,false);
Event.observe($('edtClientMail_Req_Mail_10_50'), 'click', newNewsletterFocusManage,false);       
}
function bindSendProductToAFiend()
{
Event.observe($('sendProductToAFiend'), 'submit', sendProductToAFiendManage,false);
Event.observe($('edtFriendMail_Req_Mail_10_50'), 'click', sendProductToAFiendFocusManage,false);       
}
function bindNewComment()
{
Event.observe($('newComment'), 'submit', newCommentManage,false);     
}
function bindNewRecommend()
{
Event.observe($('newRecommend'), 'submit', newRecommendManage,false);     
}
function bindPayment()
{
Event.observe($('payment'), 'submit', paymentManage,false);     
}
function bindLostPassword()
{
Event.observe($('lostPassword'), 'submit', alreadyClientManage,false);         
}
function paymentManage(e)
{
var conditions = $('checkConditions');
if(!conditions.checked)
{
Event.stop(e);
alert(MSG_ACCEPT_TERMS);
return;
}
conditions.value = 1;
}
function alreadyClientManage(e)
{   
var isChecked = checkForm(e);
if(!isChecked)
{
Event.stop(e);  
return;   
}
else
{
return;
}
}
function newClientManage(e)
{
var isChecked = checkForm(e);
if(!isChecked)
{
return;   
}
isChecked = checkPassword(
e,
$F('edtClientPassword_Req_Password_7_14'),
$F('edtClientConfirmation_Req_Password_7_14'));
if(!isChecked)
{
return;   
}
$('edtAddress_Address_0_200').value = 
$F('edtAddress_Address_0_200').inspect();    
return;   
}
function newRecipientManage(e)
{
var isChecked = checkForm(e);
if(!isChecked)
{
return;   
}
$('edtAddress_Req_Address_5_200').value = 
$F('edtAddress_Req_Address_5_200').inspect(); 
$('edtComment_Comment_5_400').value = 
$F('edtComment_Comment_5_400').inspect();      
return;  
}
function newCommentManage(e)
{
var isChecked = checkForm(e);
if(!isChecked)
{
return;   
}
$('edtComment_Req_Comment_5_4000').value = 
$F('edtComment_Req_Comment_5_4000').inspect();    
$('edtTitle_Req_Comment_2_80').value = 
$F('edtTitle_Req_Comment_2_80').inspect();    
return;   
}
function newRecommendManage(e)
{
var isChecked = checkForm(e);
return;   
}
function newContactManage(e)
{
var isChecked = checkForm(e);
if(!isChecked)
{
return;   
}
$('edtComment_Req_Comment_5_1000').value = 
$F('edtComment_Req_Comment_5_1000').inspect();    
$('edtTitle_Req_Comment_2_80').value = 
$F('edtTitle_Req_Comment_2_80').inspect();    
return;   
}
function newQuoteManage(e)
{
var isChecked = checkForm(e);
if(!isChecked)
{
return;   
}
$('edtComment_Req_Comment_5_4000').value = 
$F('edtComment_Req_Comment_5_4000').inspect();    
return;   
}
function newNewsletterManage(e)
{
var isChecked = checkForm(e);
if(!isChecked)
{
return;   
}
return;   
} 
function newNewsletterFocusManage(e)
{
if(countNewsletterField) return;
countNewsletterField ++;
Field.clear($('edtClientMail_Req_Mail_10_50')); 
Event.stop(e);          
return;                  
}
function sendProductToAFiendManage(e)
{
var isChecked = checkForm(e);
if(!isChecked)
{
return;   
}
return;   
}
function sendProductToAFiendFocusManage(e)
{
if(countSendToAFriendField) return;
countSendToAFriendField ++;
Field.clear($('edtFriendMail_Req_Mail_10_50')); 
Event.stop(e);          
return;                  
}
function checkPassword(e,word1,word2){
if(word1 !== word2)
{
var confirmation = $('edtClientConfirmation_Req_Password_7_14');
alert(MSG_PASSWORD_CONFIRMATION + MSG_NOT_VALID);
Event.stop(e);    
confirmation.focus();        
return false;
}    
else
{
return true;
}
}                                                                                       
function init()
{
if($('alreadyClient'))
{
bindAlreadyClient();
}
if($('newClient'))
{
bindNewClient();
}
if($('payment'))
{
bindPayment();
}
if($('lostPassword'))
{
bindLostPassword();       
}
if($('newComment'))
{
bindNewComment(); 
}
if($('newRecipient'))
{
bindNewRecipient();
}
if($('newContact'))
{
bindNewContact() 
}
if($('newRecommend'))
{
bindNewRecommend();
}
if($('newQuote'))
{
bindNewQuote();
}
if($('newNewsletter'))
{
bindNewNewsletter();
}
if($('sendProductToAFiend'))
{
bindSendProductToAFiend();
}
}
Event.observe(window, 'load', init);
