function display(obj,id1,id2, id3,id4,id5,id6,id7) {
txt = obj.options[obj.selectedIndex].value;//this is the value selected in select tag
document.getElementById(id1).style.display = 'none';//make everything disabled id1.
document.getElementById(id2).style.display = 'none';//make everything disabled id2.
document.getElementById(id3).style.display = 'none';
document.getElementById(id4).style.display = 'none';
document.getElementById(id5).style.display = 'none';
document.getElementById(id6).style.display = 'none';
document.getElementById(id7).style.display = 'none';

if ( txt.match(id1) ) {//if this id is selected
document.getElementById(id1).style.display = 'block';
}
if ( txt.match(id2) ) {
document.getElementById(id2).style.display = 'block';
}
if (txt.match(id3) ) {
document.getElementById(id3).style.display = 'block';
}
if ( txt.match(id4) ) {
document.getElementById(id4).style.display = 'block';
}
if ( txt.match(id5) ) {
document.getElementById(id5).style.display = 'block';
}
if ( txt.match(id6) ) {
document.getElementById(id6).style.display = 'block';
}
if ( txt.match(id7) ) {
document.getElementById(id7).style.display = 'block';
}

}

function GetXmlHttpObject(handler)  
   {  
    var objXMLHttp=null  
   if (window.XMLHttpRequest)  
  {  
  objXMLHttp=new XMLHttpRequest()  
    }  
   else if (window.ActiveXObject)  
   {  
   objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")  
   }  
   return objXMLHttp  
  }
  function stateChanged()  
   {  
      if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")  
      {  
              document.getElementById("provinces").innerHTML= xmlHttp.responseText;  
      }  
      else {  
           //alert(xmlHttp.status);  
     }  
   }  
     
	    
   // Will populate data based on input  
   function htmlData(url, qStr)  
   {  
      if (url.length==0)  
    {  
  document.getElementById("provinces").innerHTML="";  
   return;  
    }  
    xmlHttp=GetXmlHttpObject()  
   if (xmlHttp==null)  
  {  
   alert ("Browser does not support HTTP Request");  
        return;  
    }  
   
     url=url+"?"+qStr;  
    url=url+"&sid="+Math.random();  
    xmlHttp.onreadystatechange=stateChanged;  
   xmlHttp.open("GET",url,true) ;  
    xmlHttp.send(null);  
  }
state = 'none';  
  function showhide(hideDiv) {
if (state == 'block') {
state = 'none';
}
else {
state = 'block';
}
if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + hideDiv + ".style.display = state");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[hideDiv].display = state;
}
if (document.getElementById && !document.all) {
divToHide = document.getElementById(hideDiv);
divToHide.style.display = state;
}
}
function SendComment(url)
{   
var contenant=document.getElementById("sendComment");
var countryID=document.getElementById("ReportID").value; 
  var data=contenant.value;  
if (data.length==0)  
    {  
    
   return false;  
    }  
    xmlHttp=GetXmlHttpObject();  
   if (xmlHttp==null)  
  {  
   alert ("Browser does not support HTTP Request");  
        return;  
    } 
    //url=url+"?"+qStr;  
    url=url+"?"+"comment="+data; 
    url=url+"&countryID="+countryID;   
    xmlHttp.onreadystatechange=state2Changed;  
    
   xmlHttp.open("GET",url,true) ; 
    xmlHttp.send(null);
    contenant.value="";
    
    return false; 
}
function state2Changed()  
   {  

      if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")  
      { 
      var divTag = document.createElement("div");
          divTag.style.backgroundColor = '#FEFEFE';       
          divTag.innerHTML = xmlHttp.responseText;  
       var foundDIV=document.getElementById("ReportComments");//.appendChild(divTag);
       if(foundDIV.firstChild)
       {
         foundDIV.insertBefore(divTag,foundDIV.firstChild); 
         //foundDIV.appendChild(divTag); 
       } 
       else
       {
           foundDIV.appendChild(divTag);
       }
      
          
                
      }  
      else {  
           //alert(xmlHttp.status);  
     }  
   }  
function ValidateForm(myForm)
{

  var tosend=true;
  
    //check if the dom is there, and if there is the id "Required"
  if(!document.getElementById || !document.createTextNode)
  {
      return;
  }
  
  if(!document.getElementById('required'))
  {
      return;
  }
  
  var reqfields=document.getElementById('required').value.split(',');


  for(var i=0;i<reqfields.length;i++)
  {
    var f=document.getElementById(reqfields[i]);
	
    f.style.backgroundColor="white"; 
	
    if(!f)
    {
	
        continue;
    }

  } 


    
 /* 
  Now we can do what we have undone. 
  We loop over the required fields and test first if the field exists. 
  If not, we skip one round of the loop. This is purely to avoid 
  error messages, the real form markup should have all required fields.
  */
  // loop over required fields
  for(var i=0;i<reqfields.length;i++)
  {
// check if required field is there
    var f=document.getElementById(reqfields[i]);
    
    if(!f) //if the id is not there
    {

        continue;
        
    }
    

/*    
We then check each field according to its type.
 For textareas and text fields we need to check the
  value, for checkboxes we need to check for the 
  checked attribute and for select boxes if there is a selectedIndex
   defined and that it is bigger than 0.

If any of the fields have an error, 
we send it as an object to the method cf_adderr(). 
A special case is the email field, as this one also needs to be checked 
for valid email format. This check is performed by another method called
 cf_isEmailAddr(), using regular expressions.
*/
    switch(f.type.toLowerCase())
    {
      case 'text': //this is when the input is text
            if(f.value=='' && f.id!='email')
            {
                cf_adderr(f);
                 tosend=false;
                 //returnValue=false;
            }  
            // email is a special field and needs checking          
            if(f.id=='email' && !cf_isEmailAddr(f.value))
            {
                cf_adderr(f) ;
                tosend=false;
                //returnValue=false;
                
            }              
          break;
    case 'textarea':
      
           if(f.value=='')
           {   
           
               cf_adderr(f);
               tosend=false;
           }              
           break;
   case 'password':
   
             
             //var pass1 = document.dataSeller.b_passd1.value;
             //alert(pass1);
             //var secret = document.dataSeller.b_passd2.value;
             //alert(secret);  
             
           if(f.value=='')
           {
               cf_adderr(f);
               //returnValue=false;
               tosend=false;
           } 
             
          //else if(pass1!= secret)
           //{
             //   cf_adderr(f);
              // tosend=false;
                 
          //}
           
                     
           break;
    case 'checkbox':
        if(!f.checked)
        {
            cf_adderr(f);
            //returnValue=false;
            tosend=false;
        }              
        break;
 
 case 'select-one'://no idea what this is
        if(!f.selectedIndex && f.selectedIndex==0)
        {
            cf_adderr(f);
            tosend=false;
            //returnValue=false;
        }              
 break;
    }
 
  }
  


return tosend;
  
   
function cf_adderr(o)
  {  
    o.style.backgroundColor='#FFCCCC';
    o.title="This field has errors";
   }
  function cf_isEmailAddr(str) 
  {
      return str.match(/^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/);
  }
  
}
