function selOpt(oln, ListVal)
{	
	for (i=0; i < oln.length; i++)
	{
		if (oln.options[i].value == ListVal)
		{
			oln.selectedIndex = i;
			break;
		}
	}
}

function $F(id){
	return jQuery('#'+id).val();
}

function lding(dw, id, path, extra)
{
    path = (typeof path == "undefined" ? "" : path);
	extra = (typeof path == "undefined" ? "" : extra);
    switch(dw)
    {
        case '00': $(id).hide(); break;
        case '01': $(id).innerHTML = '<img src="'+path+'i/load-16w.gif" width="16" height="16" '+extra+' style="width:16px;height:16px;" />'; $(id).show();break;
    
        case '10': $(id).hide(); break;
        case '11': $(id).innerHTML = '<img src="'+path+'i/load-16g.gif" width="16" height="16" '+extra+' style="width:16px;height:16px;" />'; $(id).show();break;

		case '20': $(id).hide(); break;
        case '21': $(id).innerHTML = '<img src="'+path+'i/loadH.gif" width="43" height="11" '+extra+' style="width:43px;height:11px;" />'; $(id).show();break;
		
		case '30': $(id).hide(); break;
        case '31': $(id).innerHTML = '<img src="'+path+'i/loadH.gif" width="12" height="12" '+extra+' style="width:12;height:12px;" />'; $(id).show();break;
    }
}

var _ajx = function(u, d, c, id, i, dt, pm)
{
	dt = (typeof(dt) == "undefined" ? "string" : dt);	// return type
	pm = (typeof(pm) == "undefined" ? "post" : pm);	// posting method

	if(typeof(id)!='undefined' && id != '')
	{
		i = (typeof(i) == "undefined" ? "1" : i);
		switch(i)
		{
			case "1": i='i/load-16g.gif'; break;
			case "2": i='i/ldr-big.gif'; break;
			case "3": i='i/ldr-arr.gif'; break;
			default: i='i/load-16g.gif'; break;
		}
		var ldImg = jQuery('<img/>').attr({'src': i,'alt': 'Wait ... '});

		jQuery('#' + id).ajaxStart(function(){
		    jQuery(this).append(ldImg);
			jQuery(this).show();
		});
		jQuery('#' + id).ajaxStop(function(){
			ldImg.remove();
			jQuery(this).hide();
			jQuery(this).unbind();
		});
	}

	jQuery.ajax({url:u, type:pm, data:d, dataType:dt, success:c});
}

function _S(id)
{
	jQuery('#'+id).show();
}

function _H(id)
{
	jQuery('#'+id).hide();
}

function upCountry(co,lo,ciu, cou, ciId)
{
	if (co == 'United States' || co == 'Canada')
	{
		jQuery('#'+ciId).html('<input type="text" name="'+ciu+'" id="'+ciu+'" />');
	}
	else
	{
		data = {f:'gcities', co:co};
		_H(cou);
		_ajx('j/misc.php', data, function(x){
							jQuery('#'+ciId).html('<select name="'+ciu+'" id="'+ciu+'">'+x.msgV+'</select>');
							_S(cou);
							}, lo, '1', 'json');
	}
}
