﻿
//disable image flickering in IE
try
{
    document.execCommand("BackgroundImageCache", false, true);
} 
catch(err) 
{

}
            
//create new popup window
function OpenNewWindow(mypage,w,h,myname)
{
//alert('rfge');
    var winl = (screen.width-w)/2;
    var wint = (screen.height-h)/2;
    settings='height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=no,toolbar=no';
    win=window.open(mypage,'',settings);
    if(parseInt(navigator.appVersion) >= 4)
        {
            win.window.focus();
        }
}

 //Phone numbers
    function IntegerNumberPhone(e, text_box) 
    {  
	var tb_value=new String(text_box.value);

        var iKeyCode = 0; 
        if (window.event) 
            iKeyCode = window.event.keyCode 
        else
            if (e) 
                iKeyCode = e.which;

        if (tb_value.charAt(0)==' ')              
        {
            tb_value=tb_value.substring(1, tb_value.length);
            text_box.value=tb_value;
        }       
                
        if(iKeyCode!=8 && iKeyCode!=16 && iKeyCode!=17 && iKeyCode!=18 && 
            iKeyCode!=37 && iKeyCode!=39 && iKeyCode!=36 && iKeyCode!=9)
            {
                if(iKeyCode>=96 && iKeyCode<=105)
                {
                }
                else
                    if(iKeyCode>=48 && iKeyCode<=57)
                    {
                    }
                else
                {
                    var temp_str="";
                    var last_char;
                    var i;
                    for(i=0; i<tb_value.length; i++)
                    {
                        last_char=tb_value.charAt(i);
                        
                        if(last_char=='0'||last_char=='1'||
                            last_char=='2'||last_char=='3'||
                            last_char=='4'||last_char=='5'||
                            last_char=='6'||last_char=='7'||
                            last_char=='8'||last_char=='9'|| 
                            last_char==' '||last_char=='/'||last_char=='-'||
                            last_char==';'||last_char==',')
                        {
                            temp_str+=last_char;
                        }
                        else
                        {
                            temp_str+="";
                        }
                    }
                
                    text_box.value=temp_str;
                    tb_value=new String(text_box.value);
                }
            }
    }






