// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
Event.observe(window, 'load', function() {
	var home = $('outdoor');
	if ( home ) {
		var fG = new Flash();		
		fG.setSWF('teste', '../swf/SIPCODE.swf', 660, 240);	
		fG.setParam('allowScriptAccess', 'sameDomain');
		fG.setParam('loop', 'false');
		fG.setParam('menu', 'false');
		fG.setParam('bgcolor', '#ffffff');
		fG.setParam('wmode', 'transparent');
		fG.setParam('quality', 'high');
		fG.display("outdoor");			
	}
});
function update_select_options( target, opts_array, clear_select_list ) {
    if( $(target).type.match("select" ) ){ // Confirm the target is a select box

        // Remove existing options from the target and the clear_select_list
        clear_select_list[clear_select_list.length] = target // Include the target in the clear list

        for( k=0;k < clear_select_list.length;k++){
            obj = $(clear_select_list[k]);
            if( obj.type.match("select") ){
                len = obj.childNodes.length;
                for( var i=0;i < len;i++){obj.removeChild(obj.firstChild);}
            }
        }

        // Populate the new options
        for(i=0;i < opts_array.length;i++){
            o = document.createElement( "option" );
            o.appendChild( document.createTextNode( opts_array[i][0] ) );
            o.setAttribute( "value", opts_array[i][1] );
            obj.appendChild(o);
        }
    }
}

function update_voice_portal_number(field) {
  field_id  = field.id;
  id_number = field_id.replace('_select', '').replace('country_', '').replace('_voice_portal', '');
  Element.update("country_"+id_number+"_voice_portal", field.options[field.selectedIndex].value);
};