/*
Name:  - Trim
Desc:  - face trim pentru un sir 
Input: - sirul
Used: - java.js:
*/	
function Trim(TheString)
{
var len; 
len = TheString.length;
while(TheString.substring(0,1) == " ")
  { 
  TheString = TheString.substring(1, len);
  len = TheString.length;
  } 
while(TheString.substring(len-1, len) == " ")
  { 
  TheString = TheString.substring(0, len-1);
  len = TheString.length;
  }
return TheString;
}

/*
Name:  - getBrowserType
Desc:  - returneaza browserul pe care se lucreaza  
Used: - java.js:
*/		
function getBrowserType()
  {
   var navigatorName = new String(navigator.appName + " " + navigator.appVersion); 
   navigatorName = navigatorName.toUpperCase();
   if((navigatorName.indexOf("NETSCAPE") >= 0) && (parseInt(navigator.appVersion) >= 5) && document.getElementById)    
     return "Netscape6"; 
   else if (document.layers)
 	   return "Netscape4";
   else if (document.all) 
     return "Explorer";
   else 
     return "Unknown";	
}


/*
Name:  - getElDocument
Desc:  - returneaza forma de apelare a unui element de pe doc fct de browser
Input: - numele elementului de pe doc  
Used: - java.js:
*/		
function getElDocument(elName)
 {
		if (getBrowserType()=="Netscape6")
       return document.getElementById(elName)		
		else if (getBrowserType()=="Netscape4")
  		 return document.layers[elName];
		else if (getBrowserType()=="Explorer")
  		 return document.all(elName); 			  
 }
 
/*
Name:  - doClickPf
Desc:  - click pe caracteristica dorita
Input: - s- tipul de componenta selectata   
Used: - center_detail_pf.inc:
*/		
function doClickPf(s)
{
 document.forms['pf'].typedColor.value="";
 if(s=="BgColor")
 {	
	document.forms['pf'].typedColor.value="Bg";
  checkBgColor.innerHTML="*";
	checkFontColor.innerHTML="";
	checkFontSize.innerHTML="";
	checkPictSize.innerHTML="";
 }
 else if(s=="FontColor")
  {
	document.forms['pf'].typedColor.value="Font";
  checkBgColor.innerHTML="";
	checkFontColor.innerHTML="*";
	checkFontSize.innerHTML="";
	checkPictSize.innerHTML="";	
	}
 else	if(s=="FontSize")
  {
  checkBgColor.innerHTML="";
	checkFontColor.innerHTML="";
	checkFontSize.innerHTML="*";
	checkPictSize.innerHTML="";		
	}
 else if(s=="PictSize")
  {
  checkBgColor.innerHTML="";
	checkFontColor.innerHTML="";
	checkFontSize.innerHTML="";
	checkPictSize.innerHTML="*";			
	}	
  else
	{
	document.forms['pf'].typedColor.value="Bg";
  checkBgColor.innerHTML="*";
	checkFontColor.innerHTML="";
	checkFontSize.innerHTML="";
	checkPictSize.innerHTML="";				
	}	
}


/*
Name:  - selectColorPf
Desc:  - selectitie culoare si preview in tabel, ptr Bg si Font
Input: - type - Bg sau Font
			 - col - valoare culoare
			 - valc - valoare nume culoare   
Used: - center_detail_pf.js:
*/		
function selectColorPf(type,col,valc)
{
  if(Trim(type)!="")
	{
   s0="";
	 s0 = "document.forms['pf'].i" + type+"Color";
	 eval(s0).value=col;
	 
   s1="";
	 s1 = "document.forms['pf'].t" + type+"Color";
	 eval(s1).value=valc;
	 
	 s2="div"+type+"Color";
	 
	 s3="document.forms['pf'].t" + type+"Color";	
	 if(getBrowserType()=="Netscape6") 
	  {
		if (type=="Bg")
		 {
     getElDocument(s2).style.background = col;
		 eval(s3).style.background = valc;
		 }
		else if (type=="Font")
		 {
		 getElDocument(s2).style.color = col;
		 eval(s3).style.color = valc;
		 }		   		 
		}
	 else if (getBrowserType()=="Netscape4")
	  {
		if (type=="Bg")
		 {
     getElDocument(s2).background = col;
		 eval(s3).background = valc;
		 }
		else if (type=="Font")
		 {
		 getElDocument(s2).color = col;
		 eval(s3).color = valc;
		 }		
		}		 	 
	 if (getBrowserType()=="Explorer")
	  {
		if (type=="Bg")
		 {
     getElDocument(s2).style.background = col;
		 eval(s3).style.background = valc;
		 }
		else if (type=="Font")
		 {
		 getElDocument(s2).style.color = col;
		 eval(s3).style.color = valc; 		 
		 }		   		 				
		}		 		 		 		 
  }
}


/*
Name:  - do_popup
Desc:  - deschide popup
Input: - pagina - url
			 - x- numele paginii
			 - pw- width
			 - ph- height			 
Used: - bottom.inc
*/		   
function do_popup(pagina,x,pw,ph)
  {
   sw =1;
   sh =1;
   if (window.screen) 
     {
      sw = screen.availWidth;
      sh = screen.availHeight;
     }
   else
     {
      sw = 800;
      sh = 600;
     }
   pleft = ((sw * 1) - ( pw * 1 )) / 2 ; 
   if((pleft * 1) < 1){ pleft = 1  ; }
   ptop = ((sh * 1) - ( ph * 1 )) / 2 ; 
   if((ptop * 1) < 1){ ptop = 1  ; }
   if((pw * 1) > (sw * 1)){ pwidth = ((sw * 1) - 15)  ; } else { pwidth = pw ; }
   if((ph * 1) > (sh * 1)){ pheight = ((sh * 1) - 40)  ; } else { pheight = ph ; }
   var w=window.open(pagina,'xrc' + x,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width='+pwidth+',height='+pheight+',top='+ptop+',left='+pleft);
   w.focus();
  }

/*
Name:  - openTarget
Desc:  - subimt catre popup
Input: - form forma
			 - pw- width
			 - ph- height			 
Used: - center_detail_pf.inc
*/		   
function openTarget (form, pw,ph, windowName) {
   sw =1;
   sh =1;
   if (window.screen) 
     {
      sw = screen.availWidth;
      sh = screen.availHeight;
     }
   else
     {
      sw = 800;
      sh = 600;
     }
   pleft = ((sw * 1) - ( pw * 1 )) / 2 ; 
   if((pleft * 1) < 1){ pleft = 1  ; }
   ptop = ((sh * 1) - ( ph * 1 )) / 2 ; 
   if((ptop * 1) < 1){ ptop = 1  ; }
   if((pw * 1) > (sw * 1)){ pwidth = ((sw * 1) - 15)  ; } else { pwidth = pw ; }
   if((ph * 1) > (sh * 1)){ pheight = ((sh * 1) - 40)  ; } else { pheight = ph ; }

	 
  if (!windowName)
    windowName = 'formTarget' + (new Date().getTime());
  form.target = windowName;
  open ('', windowName, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width='+pwidth+',height='+pheight+',top='+ptop+',left='+pleft);  	
}



/*
Name:  - doClickJk
Desc:  - click pe caracteristica dorita
Input: - s- tipul de componenta selectata   
Used: - center_detail_jk.js:
*/		
function doClickJk(s)
{
 document.forms['jk'].typedColor.value="";
 if(s=="BgColor")
 {	
	document.forms['jk'].typedColor.value="Bg";
	//document.forms['jk'].rtypedColor[0].checked=true;
  checkBgColor.innerHTML="*";
	checkFontColor.innerHTML="";
	checkFontSize.innerHTML="";
	checkPictSize.innerHTML="";
 }
 else if(s=="FontColor")
  {
	document.forms['jk'].typedColor.value="Font";
	//document.forms['jk'].rtypedColor[2].checked=true;
  checkBgColor.innerHTML="";
	checkFontColor.innerHTML="*";
	checkFontSize.innerHTML="";
	checkPictSize.innerHTML="";	
	}
 else if(s=="BgTColor")
  {
	document.forms['jk'].typedColor.value="BgT";	
  checkBgColor.innerHTML="*";
	checkFontColor.innerHTML="";
	checkFontSize.innerHTML="";
	checkPictSize.innerHTML="";	
	}
 else if(s=="FontTColor")
  {
	document.forms['jk'].typedColor.value="FontT";
  checkBgColor.innerHTML="";
	checkFontColor.innerHTML="*";
	checkFontSize.innerHTML="";
	checkPictSize.innerHTML="";		
	}			
 else	if(s=="FontSize")
  {
  checkBgColor.innerHTML="";
	checkFontColor.innerHTML="";
	checkFontSize.innerHTML="*";
	checkPictSize.innerHTML="";		
	}
 else if(s=="PictSize")
  {
  checkBgColor.innerHTML="";
	checkFontColor.innerHTML="";
	checkFontSize.innerHTML="";
	checkPictSize.innerHTML="*";			
	}	
  else
	{
	document.forms['jk'].typedColor.value="Bg";
  checkBgColor.innerHTML="*";
	checkFontColor.innerHTML="";
	checkFontSize.innerHTML="";
	checkPictSize.innerHTML="";				
	}	
}


/*
Name:  - selectColorJk
Desc:  - selectitie culoare si preview in tabel, ptr Bg si Font
Input: - type - Bg sau Font
			 - col - valoare culoare
			 - valc - valoare nume culoare   
Used: - center_detail_jk.js:
*/		
function selectColorJk(type,col,valc)
{
  if(Trim(type)!="")
	{
   s0="";
	 s0 = "document.forms['jk'].i" + type+"Color";
	 eval(s0).value=col;
	 
   s1="";
	 s1 = "document.forms['jk'].t" + type+"Color";
	 eval(s1).value=valc;
	 
	 s2="div"+type+"Color";
	 
	 s3="document.forms['jk'].t" + type+"Color";	
	 if(getBrowserType()=="Netscape6") 
	  {
		if (type=="Bg" || type=="BgT")
		 {
     getElDocument(s2).style.background = col;
		 eval(s3).style.background = valc;
		 }
		else if (type=="Font"  || type=="FontT")
		 {
		 getElDocument(s2).style.color = col;
		 eval(s3).style.color = valc;
		 }		   		 
		 
		}
	 else if (getBrowserType()=="Netscape4")
	  {
		if (type=="Bg"  || type=="BgT")
		 {
     getElDocument(s2).background = col;
		 eval(s3).background = valc;
		 }
		else if (type=="Font"  || type=="FontT")
		 {
		 getElDocument(s2).color = col;
		 eval(s3).color = valc;
		 }		
		}		 	 
	 if (getBrowserType()=="Explorer")
	  {
		if (type=="Bg"  || type=="BgT")
		 {
     getElDocument(s2).style.background = col;
		 eval(s3).style.background = valc;
		 }
		else if (type=="Font"  || type=="FontT")
		 {
		 getElDocument(s2).style.color = col;
		 eval(s3).style.color = valc;
		 }		   		 				
		}		 		 		 		 
  }
}	