﻿var controls = document.getElementsByTagName('form');
window.onload = my_init;

function my_init() {
    
	if(!document.getElementById) {return false;}
	
	for (var nf = 0; nf < document.getElementsByTagName('form').length; nf++) {
	    for(var nfi = 0; nfi < document.forms[nf].getElementsByTagName('input').length; nfi++){
	        var o=document.forms[nf].getElementsByTagName('input')[nfi];
	        if(o.type=="text"){	            
	        
	            o.className="inpt";	            
	            o.onclick = new Function('ChangeClassName(this,"inpt-hover")');
	            o.onmouseover = new Function('ChangeClassName(this,"inpt-focus")');
	            o.onmouseout = new Function('ChangeClassName(this,"inpt")');	            
	            
	        }else if(o.type=="checkbox"){
	            o.className="chk";	            
	            o.onmouseover = new Function('ChangeClassName(this,"chk-hover")');
	            o.onmouseout = new Function('ChangeClassName(this,"chk")');	            
	        }
	    }
	        
	    for(var nft = 0; nft < document.forms[nf].getElementsByTagName('textarea').length; nft++){
	        var o =  document.forms[nf].getElementsByTagName('textarea')[nft];
	        o.className="area";
	        o.onclick = new Function('ChangeClassName(this,"area-hover")');
            o.onmouseover = new Function('ChangeClassName(this,"area-focus")');
            o.onmouseout = new Function('ChangeClassName(this,"area")');
	    }
	    for(var nfs = 0; nfs < document.forms[nf].getElementsByTagName('select').length; nfs++){
	        var o = document.forms[nf].getElementsByTagName('select')[nfs];
	        
	        o.className="sel";
	        o.onmouseover = new Function('ChangeClassName(this,"sel-focus")');
            o.onmouseout = new Function('ChangeClassName(this,"sel")');
	    }
		
	}	
}

function ChangeClassName(cnt,classNM){
    cnt.className=classNM;
}

function confirmDelete()
{
    var agree=confirm("Delete this item?");
    if (agree)
        return true ;
    else
        return false ;
}


var curr_id;
function ShowPanel(id){    
    if(curr_id != null && curr_id!='')
        document.getElementById(curr_id).style.display='none';
       
    curr_id=id;
    if(curr_id != null && curr_id!='')
        document.getElementById(curr_id).style.display='';
}

function ShowImage(id) {
    document.getElementById('or'+id).src="PhotoO"+id+".aspx";
}

  function checkForm(tb1,tb2,tb3,im)
  { 
   if (
    document.getElementById(tb1).value=='' ||
    document.getElementById(tb2).value=='' ||
    document.getElementById(tb3).value=='' 	
    )
	{
	 document.getElementById(im).src = 'images/but_send_0.jpg';
	 document.getElementById(im).disabled = 1;
	}
	else
	{
	 document.getElementById(im).src = 'images/but_send_1.jpg';
	 document.getElementById(im).disabled = 0;	 
	}
  }