
var limitAdText = 150;
 var limitKeywords = 100;
 
 function checkAdText() {
   if(document.f.desription.value.length > limitAdText) {
     alert('Too many character.');
     document.f.desription.focus();
     return false; }
   else
     return true; }
	 
 function checkKeywords() {
   if(document.f.keywords.value.length > limitKeywords) {
     alert('Too many character.');
     document.f.keywords.focus();
     return false; }
   else
     return true; }
	 
 function updateAdText() {
   var old = document.f.counter.value;
   document.f.counter.value=document.f.description.value.length;
   if(document.f.counter.value > limitAdText && old <= limitAdText) {
     alert('Too many characters');
     if(document.styleSheets) {
       document.f.counter.style.fontWeight = 'bold';
       document.f.counter.style.color = '#ff0000'; } }
   else if(document.f.counter.value <= limitAdText && old > limitAdText
	   && document.styleSheets ) {
       document.f.counter.style.fontWeight = 'normal';
       document.f.counter.style.color = '#000000'; } 
   }
   
 function updateKeywords() {
   var old = document.f.counter2.value;
   document.f.counter2.value=document.f.keywords.value.length;
   if(document.f.counter2.value > limitKeywords && old <= limitKeywords) {
     alert('Too many characters');
     if(document.styleSheets) {
       document.f.counter2.style.fontWeight = 'bold';
       document.f.counter2.style.color = '#ff0000'; } }
   else if(document.f.counter.value <= limitKeywords && old > limitKeywords
	   && document.styleSheets ) {
       document.f.counter2.style.fontWeight = 'normal';
       document.f.counter2.style.color = '#000000'; } 
   }
   
 function goToPage(url){
	 window.location.href = url;
 }
 
 function changeTypeDirFar(objID){
	document.getElementById('titleField').style.direction = 'rtl';
	document.getElementById('descriptionField').style.direction = 'rtl';
	document.getElementById('keywordsField').style.direction = 'rtl';
	
 }
 
 function changeTypeDirEng(objID){
	document.getElementById('titleField').style.direction = 'ltr';
	document.getElementById('descriptionField').style.direction = 'ltr';
	document.getElementById('keywordsField').style.direction = 'ltr';
 } 
