function Is ()
{   var agt=navigator.userAgent.toLowerCase();

    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);

    this.nav  = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1)));
    this.nav2 = (this.nav && (this.major == 2));
    this.nav3 = (this.nav && (this.major == 3));    

    this.vms   = (agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1);
}


var is = new Is(); 

	function selectCountry(country){		
		SetActiveCountry(country);
		countryid=country;
		//alert(size(countries[country]));
		if(countries[country]) {
			/*for(var key in countries[country]) 
				changeDisabled(key, countries[country][key]);
			*/
			for(var key in countries[country]) {
				changeEnabled(key, countries[country][key]);
				//break;
			}
				
		}						
	}
	
	
function addHandler(object, event, handler, useCapture) { 
      if (object.addEventListener) {       	
            object.addEventListener(event, handler, useCapture ? useCapture : false); 
      } else if (object.attachEvent) { 
            object.attachEvent('on' + event, handler); 
      } else alert("Add handler is not supported"); 
} 

function removeHandler(object, event, handler)
{
if (typeof object.removeEventListener != 'undefined')
object.removeEventListener(event, handler, false);
else if (typeof object.detachEvent != 'undefined')
object.detachEvent('on' + event, handler);
else
throw "Incompatible browser";
} 
	
	
function changeEnabled(optionId, value){					
	p_objectById=p_object.getElementById(optionId+'li');		   
	
	turn='';		

	if(value==1){
			active='';			
			p_objectById.className='';
			p_object.getElementById(optionId).className='';	
			
			addHandler(p_objectById, "mouseover", function(){lightup(aonover[optionId])});	  
			addHandler(p_objectById, "mouseout", function(){turnoff(aonover[optionId])});
			addHandler(p_objectById, "click", function(){turncheck(aoncheck[optionId], aonover[optionId])});					
			
			imgOff=eval("pic1_dis.src");
			document[aonover[optionId]].src= imgOff;

			imgOff=eval("pic1.src");
			document[aonover[optionId]].src= imgOff;		
			
			//turnoff(aonover[optionId]);						
		 } else{	
	
			active='';
			if (!is.nav)	p_objectById.clearAttributes();
			
			p_objectById.className='disable';
			p_object.getElementById(optionId).className='disable';
		
			removeHandler(p_objectById, "mouseover", function(){lightup(aonover[optionId])});	  
			removeHandler(p_objectById, "mouseout", function(){turnoff(aonover[optionId])});
			removeHandler(p_objectById, "click", function(){turncheck(aoncheck[optionId], aonover[optionId])});			
			imgOff=eval("pic1_dis.src");
			document[aonover[optionId]].src= imgOff;
//			turnoff(aonover[optionId]);
		 }

     }
	
     
function changeDisabled(optionId, value){					
	p_objectById=p_object.getElementById(optionId);		
	//name1= $("#"+optionId);
			active='';	
			
			p_objectById.className='disable';
			p_object.getElementById(optionId+'li').className='disable';						
		
			removeHandler(p_objectById, "mouseover", function(){lightup(aonover[optionId])});	  
			removeHandler(p_objectById, "mouseout", function(){turnoff(aonover[optionId])});
			removeHandler(p_objectById, "click", function(){turncheck(aoncheck[optionId], aonover[optionId])});			
			removeHandler(p_objectById, "onmouseover", function(){lightup(aonover[optionId])});	  
			removeHandler(p_objectById, "onmouseout", function(){turnoff(aonover[optionId])});
			removeHandler(p_objectById, "onclick", function(){turncheck(aoncheck[optionId], aonover[optionId])});			
			//removeHandler(p_objectById, "onmouseover", lightup);	  
			//removeHandler(p_objectById, "onmouseout", turnoff);
			//removeHandler(p_objectById, "onclick", turncheck);			
			
			imgOff=eval("pic1_dis.src");
			document[aonover[optionId]].src= imgOff;

     }     
	
	function turncheck(Id, name){		
		//document.flashmap.turn.value=Id;		
		turn=Id;
		activeold=active;
		active=name;
		lightup(active);		
		if(activeold!=''){ turnoff(activeold);
			
		}
		
	}	
	
