var highlightbehavior="TD"
var ns6=document.getElementById&&!document.all
var ie=document.all
function changeto(e,highlightcolor){
source=ie? event.srcElement : e.target
if (source.tagName=="TABLE")
return
while(source.tagName!=highlightbehavior && source.tagName!="HTML")
source=ns6? source.parentNode : source.parentElement
if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
source.style.backgroundColor=highlightcolor
}
function contains_ns6(master, slave) { //check if slave is contained by master
while (slave.parentNode)
if ((slave = slave.parentNode) == master)
return true;
return false;
}
function obn(f,w,h)
{
window.open(f, 'win', config='height='+h+',width='+w+',scrollbars=1');
}
function winscan(f,w,h)
{
window.open(f, 'win', config='height='+h+',width='+w+',scrollbars=0');
}

function changeback(e,originalcolor){
if (ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")||source.tagName=="TABLE")
return
else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore"))
return
if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source)
source.style.backgroundColor=originalcolor
}

var speed = 50 // decrease value to increase speed (must be positive)
var pause = 2500 // increase value to increase pause
var timerID = null
var bannerRunning = false
var ar = new Array()
ar[0] = "Welcome  to Kaspersky.ir"
ar[1] = "PREMIER PROTECTION AGAINST VIRUSES, HACKERS AND SPAM"
ar[2] = "Advance Tarsim Rayaneh Engineering Co."
ar[3] = "Anti-Virus      Anti-Hacker      Anti-Spam      Gateway Protection"

var currentMessage = 0
var offset = 0
function stopBanner() {
        if (bannerRunning)
                clearTimeout(timerID)
        bannerRunning = false
}
function startBanner() {
        stopBanner()
        showBanner()
}
function showBanner() {
        var text = ar[currentMessage]
        if (offset < text.length) {
                if (text.charAt(offset) == " ")
                        offset++                        
                var partialMessage = text.substring(0, offset + 1) 
                window.status = partialMessage
                offset++ 
                timerID = setTimeout("showBanner()", speed)
                bannerRunning = true
        } else {
                offset = 0
                currentMessage++
                if (currentMessage == ar.length)
                        currentMessage = 0
                timerID = setTimeout("showBanner()", pause)
                bannerRunning = true
        }
}
  function result() 
  {
    var left = (screen.width - 400)/2
    var top =  (screen.height - 300)/2
    window.open( "", "scan", "width=800"+
                 ",height=600,left="+left+
                 ",top="+top+",scrollbars=yes")
    document.forms[0].target = "scan";
    return true;
  } 
function FP_swapImgRestore() {//v1.0
 var doc=document,i; if(doc.$imgSwaps) { for(i=0;i<doc.$imgSwaps.length;i++) {
  var elm=doc.$imgSwaps[i]; if(elm) { elm.src=elm.$src; elm.$src=null; } } 
  doc.$imgSwaps=null; }
}

function FP_swapImg() {//v1.0
 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
 n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
 elm.$src=elm.src; elm.src=args[n+1]; } }
}

function FP_preloadImgs() {//v1.0
 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array();
 for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; }
}

function FP_getObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}

function winopen_noscroll(f,w,h)
{
window.open(f, 'win', config='height='+h+',width='+w+',toolbar=no,status=no,maxsize=no,resizable=no,scrollbars=no,menubar=no');
}




var strUserAgent = navigator.userAgent.toLowerCase(); 
			var isIE = strUserAgent.indexOf("msie") > -1; 
			var isNS6 = strUserAgent.indexOf("netscape6") > -1; 
			var isNS4 = !isIE && !isNS6  && parseFloat(navigator.appVersion) < 5; 
			
			//regular expressions
			var reValidChars = /\d/;
		
			//mask function
			function KeyPress_Numeric_Int(objEvent,val) {
				var iKeyCode, strKey;  
                var msg
               if (val=='1') msg="1"
               
               
				if (isIE) {
				    iKeyCode = objEvent.keyCode;
				} else {
				    iKeyCode = objEvent.which;
				}
				
				strKey = String.fromCharCode(iKeyCode);
				if (!reValidChars.test(strKey)) {
					return false;
				}
			}			
		
//--------------------------------------------------------------------	
function winfaq(value)
{
ops = eval("'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width=720,height=600,top=0,left=0'");
window.open(value,"",ops);}

//-----------------------------------------------------------------------------------------------------------
			//browser detection
			var strUserAgent = navigator.userAgent.toLowerCase(); 
			var isIE = strUserAgent.indexOf("msie") > -1; 
			var isNS6 = strUserAgent.indexOf("netscape6") > -1; 
			var isNS4 = !isIE && !isNS6  && parseFloat(navigator.appVersion) < 5; 
			
			//regular expressions
			var reValidChars = /\d/;
		
			//mask function
			function KeyPress_String(objEvent,val) {
				var iKeyCode, strKey;  
                var msg
               if (val=='1') msg="1"
        
               
				if (isIE) {
				    iKeyCode = objEvent.keyCode;
				} else {
				    iKeyCode = objEvent.which;
				}
				
				strKey = String.fromCharCode(iKeyCode);
				if (reValidChars.test(strKey)) {
										return false;
				}
			}			
		
//-----------------------------------------------------------------------------------------------------------

			function Mask_English(obj) 
			{
				var iKeyCode, strKey,UpperKey,strLen;  
               	
                strLen=obj.value.length;
                
               	if (isIE) 
				{
				  iKeyCode = event.keyCode;
				} 
				else 
				{
				  iKeyCode = event.which;
				}
								
				if (iKeyCode>=65 && iKeyCode<=90)			
				{
				 return true                              
				}
				if (iKeyCode>=97 && iKeyCode<=122)			
				{
				 return true                              
				}
				if (iKeyCode==32 && strLen!=0)			
				{
				 return true                              
				}
	           
				return false
			}			
//-----------------------------------------------------------------------------------------------------------			
            function UpperCase_FirstCharString(obj) 
			{
			var strVal;
			
			strVal=obj.value;
			strVal=strVal.substring(0,1).toUpperCase()+strVal.substring(1,strVal.length);
			obj.value=strVal;
			return true
			}			
//-----------------------------------------------------------------------------------------------------------	
function Mask_Number() 
			{
				var iKeyCode, strKey;    
               	if (isIE) 
				{
				  iKeyCode = event.keyCode;
				} 
				else 
				{
				  iKeyCode = event.which;
				}
							
				if (iKeyCode>=48 && iKeyCode<=57)			
				{
				 return true                              
				}
	           
				return false
			}			

//-----------------------------------------------------------------------------------------------------------	
function Mask_Farsi(objEvent) 
			{
				var iKeyCode, strKey;  
               	
           
                
               	if (isIE) 
				{
				  iKeyCode = objEvent.keyCode;
				} 
				else 
				{
				  iKeyCode = objEvent.which;
				}
								
				alert(iKeyCode)	           
				return false
			}			
//-----------------------------------------------------------------------------------------------------------

//-----------------------------------------------------------------------------------------------------------

var lang = 1;	// 1: Farsi, 0: English

// Farsi keyboard map based on Iran Popular Keyboard Layout

var farsikey = [
   0x0020, 0x0021, 0x061B, 0x066B, 0x00A4, 0x066A, 0x060C, 0x06AF,
   0x0029, 0x0028, 0x002A, 0x002B, 0x0648, 0x002D, 0x002E, 0x002F,
   0x06F0, 0x06F1, 0x06F2, 0x06F3, 0x06F4, 0x06F5, 0x06F6, 0x06F7,
   0x06F8, 0x06F9, 0x003A, 0x06A9, 0x003E, 0x003D, 0x003C, 0x061F,
   0x066C, 0x0624, 0x200C, 0x0698, 0x06CC, 0x064D, 0x0625, 0x0623,
   0x0622, 0x0651, 0x0629, 0x00BB, 0x00AB, 0x0621, 0x004E, 0x005D,
   0x005B, 0x0652, 0x064B, 0x0626, 0x064F, 0x064E, 0x0056, 0x064C,
   0x0058, 0x0650, 0x0643, 0x062C, 0x0698, 0x0686, 0x00D7, 0x0640,
   0x067E, 0x0634, 0x0630, 0x0632, 0x064A, 0x062B, 0x0628, 0x0644,
   0x0627, 0x0647, 0x062A, 0x0646, 0x0645, 0x0626, 0x062F, 0x062E,
   0x062D, 0x0636, 0x0642, 0x0633, 0x0641, 0x0639, 0x0631, 0x0635,
   0x0637, 0x063A, 0x0638, 0x007D, 0x007C, 0x007B, 0x007E
];

// on Alt+Shift, switch language
function FKeyDown()
{
   if (window.event.shiftKey && window.event.altKey) { 
      if (lang == 0) {
         lang = 1;
         window.defaultStatus = "Farsi Mode";
      }
      else {
         lang = 0;
         window.defaultStatus = "English Mode";
      }
      return false;
   }
   return true;
}

// change the Farsi
function FKeyPress()
{
   var key = window.event.keyCode;
   // Avoid processing if control or higher than ASCII (i.e., in Arabic Windows)
   if (key < 0x0020 || key >= 0x00FF)
      return;
   if (lang == 1) { //If Farsi
      if (key == 0x0020 && window.event.shiftKey) // Shift-space -> ZWNJ
         window.event.keyCode = 0x200C;
      else
         window.event.keyCode = farsikey[key - 0x0020];
   }
   return true;
}


function LangFar (myobj)
{
       myobj.style.textAlign = "right";
       myobj.style.direction = "rtl";
       myobj.focus();
       lang = 1;
}


function LangEng (myobj)
{
       myobj.style.textAlign = "left";
       myobj.style.direction = "ltr";
       myobj.focus();
       lang = 0;
}


//-----------------------------------------------------------------------------------------------------------

function Mask_Email() 
			{
				var iKeyCode, strKey,UpperKey,strLen;  
              
               	if (isIE) 
				{
				  iKeyCode = event.keyCode;
				} 
				else 
				{
				  iKeyCode = event.which;
				}
								
				if (iKeyCode>=65 && iKeyCode<=90)			
				{
				 return true                              
				}
				if (iKeyCode>=97 && iKeyCode<=122)			
				{
				 return true                              
				}
				if (iKeyCode==46 || iKeyCode==45 || iKeyCode==95 || iKeyCode==64 )			
				{
				 return true                              
				}
				if (iKeyCode>=48 && iKeyCode<=57)			
				{
				 return true                              
				}

	           
				return false
			}			
			
//-----------------------------------------------------------------------------------------------------------
function Mask_StringWithoutSpace() 
			{
				var iKeyCode, strKey,UpperKey,strLen;  
              
               	if (isIE) 
				{
				  iKeyCode = event.keyCode;
				} 
				else 
				{
				  iKeyCode = event.which;
				}				
				if (iKeyCode>=65 && iKeyCode<=90)			
				{
				 return true                              
				}

				if (iKeyCode>=97 && iKeyCode<=122)			
				{
				 return true                              
				}
				if (iKeyCode>=48 && iKeyCode<=57)			
				{
				 return true                              
				}
				return false
			}			
//-----------------------------------------------------------------------------------------------------------

function LowerCase_String(obj) 
			{
			var strVal;
			strVal=obj.value.toLowerCase()
			obj.value=strVal;
			return true
			}			
//-----------------------------------------------------------------------------------------------------------
function Mask_Moadel(obj) 
			{
				var iKeyCode, strKey,i,strVal,strLen,flag;    
               	if (isIE) 
				{
				  iKeyCode = event.keyCode;
				} 
				else 
				{
				  iKeyCode = event.which;
				}
				
                strVal=obj.value;
                strLen=strVal.length;
                strKey = String.fromCharCode(iKeyCode);
               
               if(iKeyCode>=48 && iKeyCode<=57 || iKeyCode==46)
               {                    
                if (iKeyCode==46)
                {
                 if(strLen>=3)
                 {
                  return false
                 }
                 for(i=0;i<strLen;i++)
                 {
                 if (strVal.charAt(i)==".")
                 {
                  return false
                 }
                 }//end for
                }
                return true
               }
               else
               {
                return false
               }             	          
			}	
//-----------------------------------------------------------------------------------------------------------

function Format_Moadel(obj)	
         {
          var strKey,i,strVal,strLen,intPlan;
          
          strVal=obj.value;
          strLen=strVal.length;
          obj.value=""
          
          for(i=0;i<strLen;i++)
          {
           if(strVal.charAt(i)==".")
           {
            intPlan=i;
            i=strLen;
           }
           else
           {
            intPlan=99;
           }
          }
          //if "." is first character
          if(intPlan==0)
          {
           if(strLen==1)
            {
              obj.value="00.00";
              return true           
            }
            
            if(strLen==2)
            {
              obj.value="00"+strVal+"0";
              
              return true           
            }

            if(strLen==3)
            {
              obj.value="00"+strVal;
              return true           
            }
             
            if(strLen==4 || strLen==5)
            {
              obj.value="00"+strVal.substring(0,3);
              return true           
            }
           }

          //if "." is second character
          if(intPlan==1)
          {
           if(strLen==2)
            {
              obj.value="0"+strVal+"00";
              return true           
            }
            
            if(strLen==3)
            {
              obj.value="0"+strVal+"0";
              return true           
            }

            if(strLen==4)
            {
              obj.value="0"+strVal;
              return true           
            }
             
            if(strLen==5)
            {
              obj.value="0"+strVal.substring(0,4);
              return true           
            }
           }


          //if "." is third character
          if(intPlan==2)
          {
            if(strLen==3)
            {
              obj.value=strVal+"00";
              return true           
            }

            if(strLen==4)
            {
              obj.value=strVal+"0";
              return true           
            }
             
            if(strLen==5)
            {
              obj.value=strVal;
              return true           
            }
           }

           
          //if "." is not to be
          if(intPlan==99)
          {
            if(strLen==1)
            {
              obj.value=strVal+"0.00";
              return true           
            }

            if(strLen==2)
            {
              obj.value=strVal+".00";
              return true           
            }
             
            if(strLen>=3)
            {
              obj.value=strVal.substring(0,2)+".00";
              return true           
            }
           }
         }


	
//-----------------------------------------------------------------------------------------------------------

function winopen(f,w,h)
{
window.open(f, 'win', config='height='+h+',width='+w+',scrollbars=0');
}

//-----------------------------------------------------------------------------------------------------------







