//
//  Insert data in to  table HTML patge
//
        function insertInToTable(tblId, varRow, varCell, varData){
                try{
                        var x=document.getElementById(tblId).rows[varRow].cells;
                        x[varCell].innerHTML=varData;
                        return false;
                }
                catch(Err){
                        return false;
                }
        }

//

//
//  Insert data in to  table DIV patge
//
        function insertInToDIV(tblId, varData){

                        var x=document.getElementById(tblId);
                        x.innerHTML=varData;
                        return false;
        }

//

function getValue(myId)
{
        return document.getElementById(myId).value;
}

function putValue(myId,myValue)
{
        document.getElementById(myId).value = myValue ;
}

//
//  Input validator
//
        function txtBoxValidation(myId,defaultColor,errColor){
                
                // # My property
        
                        me=document.getElementById(myId);

                        if(me.value==""){        
                                me.style.background=errColor;
                                me.focus();
                                return false;
                        }
                        else{
                                me.style.background=defaultColor;
                                me.focus();
                                return true;
                        }
        
        }

// 
 
//  
// HIEKE A OBJECT 
//
function hideMe(myId){
        document.getElementById(myId).style.display="none";
        
}
//

//
// TO SHOW A OBJECT 
//
function showMe(myId){
        document.getElementById(myId).style.display="block";
        
}
//




// !!!!!!  ASSIGN VALUE IN TO A OBJECT

function directMyvalueto(myValue,thatId){
        document.getElementById(thatId).value=myValue;
}
// END 

// CHANGE IMAGE
function changeImage(myId,img1,img2){
        if(img1==document.getElementById(myId).src){
                document.getElementById(myId).src=img2;
        }
        else{
                document.getElementById(myId).src=img1;
        }
}

function xyLocation(myId,x,y){
        document.getElementById(myId).style.left =x; 
        document.getElementById(myId).style.top =y;
}

function roundMe(myValue,myRange)
{
        
        var unit = myRange / 2;
        var niddle = myValue % myRange;
        var scope = parseInt( myValue / myRange);

        if ( unit < niddle)
        {
                return (scope + 1) * myRange;
        }
        else {
                return scope  * myRange
        }
        
}


function get_resolution( action )
{
        var browser_name = get_browser( 'name' );

        if ( action == 'width')
        {
                if ( browser_name == 'netscape')
                {
                                return window.innerWidth;
                }
                else if ('ie')
                {
                                return screen.width;
                }
        }

}


function get_browser( action )
{


if( action == 'name' )
{
        if ( navigator.appName == 'Netscape')
        {
                        return 'netscape';
        }
        else if ( navigator.appName =='Microsoft Internet Explorer')
        {
                        return 'ie';
        }
}

/*
document.write("<p>Browserversion: ")
document.write(navigator.appVersion + "</p>")

document.write("<p>Code: ")
document.write(navigator.appCodeName + "</p>")

document.write("<p>Platform: ")
document.write(navigator.platform + "</p>")

document.write("<p>Cookies enabled: ")
document.write(navigator.cookieEnabled + "</p>")

document.write("<p>Browser's user agent header: ")
document.write(navigator.userAgent + "</p>")
*/
/*
document.write("Screen resolution: ")
document.write(screen.width + "*" + screen.height)
document.write("<br />")
document.write("Available view area: ")
document.write(screen.availWidth + "*" + screen.availHeight)
document.write("<br />")
document.write("Color depth: ")
document.write(screen.colorDepth)
document.write("<br />")
document.write("Buffer depth: ")
document.write(screen.bufferDepth)
document.write("<br />")
document.write("DeviceXDPI: ")
document.write(screen.deviceXDPI)
document.write("<br />")
document.write("DeviceYDPI: ")
document.write(screen.deviceYDPI)
document.write("<br />")
document.write("LogicalXDPI: ")
document.write(screen.logicalXDPI)
document.write("<br />")
document.write("LogicalYDPI: ")
document.write(screen.logicalYDPI)
document.write("<br />")
document.write("FontSmoothingEnabled: ")
document.write(screen.fontSmoothingEnabled)
document.write("<br />")
document.write("PixelDepth: ")
document.write(screen.pixelDepth)
document.write("<br />")
document.write("UpdateInterval: ")
document.write(screen.updateInterval)
document.write("<br />")
*/
}


function changemode( myId, mode)
{	
		
	if( mode == 'disabled' )
	{
		
		document.getElementById(myId).disabled = true;	
	}
	if( mode == 'readonly' )
	{
		document.getElementById(myId).disabled = true;	
	}
	else if ( mode == 'write' )
	{
		document.getElementById(myId).disabled = false;	
	}	
}

function show_box( myId, mode)
{	
		
	if( mode == 'yes' )
	{
		
		document.getElementById(myId).style.display= "block";
	
	}
	
	else
	{
		document.getElementById(myId).style.display= "none";
	
	}	
}



