	//var loctype=<? echo $type; ?>;
	
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////

	//var loctype=$(formloctype).html();

function getCity(iCountry,iProv,mode,oCityTR)
{
	var testpage;
	
	
	var sS2=/\[\]/;
//	if (mode==1)
//		testpage = xmlregion + "?did="+iCountry+ "&type="+$('formloctype').html();
//	else
//		testpage = xmlregion + "?pid="+iProv+ "&type="+$('formloctype').html();
	
		$$.rmsSend({ mod:'region', op:'city', iMode:mode, iC:iCountry, iP:iProv,iType:$('#formloctype').html() },function(oRmsR) {																																						
			$(oCityTR).find('select').html(oRmsR['rmsD']['data']);
			$(oCityTR).find('select option:first').attr('selected','true');
			return;																											 																											 	});	
	
	
}
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////

function getProv(iCountry,oProvTR)
{
//	if ( (iCountry!=35)	&& (iCountry!=194)) return;
	
//	var testpage = xmlregion + "?cid="+iCountry+ "&type="+$('formloctype').html();
	
		$$.rmsSend({ mod:'region', op:'prov', iC:iCountry ,iType:$('#formloctype').html()},function(oRmsR) {		
			$(oProvTR).find('.provtag').html(oRmsR['rmsD']['sProvTag']);
			$(oProvTR).find('select').html(oRmsR['rmsD']['data']);
			$(oProvTR).find('select option:first').attr('selected','true');																																						
			return;																											 																											 	});		
	
/*	
	$.ajax({
	type: "GET",
	url: testpage,
	data: "",
	dataType: "html",
	success: function(data){
				$(oProvTR).find('select').html(data);
				$(oProvTR).find('select option:first').attr('selected','true');
				return;	
	}
	});	
*/
}

////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
		
		function changeCountry(oCountrySelect)
		{		
			var oProvTR=$(oCountrySelect).parents('.ripCountry').siblings('.ripProv');
			var oCityTR=$(oCountrySelect).parents('.ripCountry').siblings('.ripCity');			
			var oNewCityTR=$(oCountrySelect).parents('.ripCountry').siblings('.ripNewCity');	
		
			if (oCountrySelect.value>0)
			{
				$(oCountrySelect).parents('.ripCountry').find('.ripError').remove();
				$(oCountrySelect).siblings("img").attr({ src: $('#formxs').html()+"f/s/"+oCountrySelect.value+".gif", alt: "Flag Image" });
			}
			else
			{
				$(oCountrySelect).siblings("img").attr({ src: $('#formxs').html()+"/f/s/0.gif", alt: "Flag Image" });
				//$(oCountrySelect).siblings("img").hide();
			}
			
			
			getProv(oCountrySelect.value,oProvTR);		

			$(oNewCityTR).hide();

			if (oCountrySelect.value==35 || oCountrySelect.value==194)
			{		
					$(oProvTR).show();
					$(oCityTR).hide();

			}
			else
			{		
					$(oCityTR).show();
					$(oProvTR).hide();
			
				if (oCountrySelect.value<1)
				{
					$(oCityTR).hide();
					$(oProvTR).hide();
				}
				else
				{
					//if (document.getElementById('newcityTR'))
					//	document.getElementById('newcityTR').style.display='none';				
					getCity(oCountrySelect.value,'',1,oCityTR);								
				}
			}				
		return;
		}
		
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
		function changeProv(oProvSelect)
		{
			var oCityTR=$(oProvSelect).parents('.ripProv').siblings('.ripCity');	
			var oNewCityTR=$(oProvSelect).parents('.ripProv').siblings('.ripNewCity');	
			
			$(oNewCityTR).hide();

			$(oCityTR).find('.ripError').remove();
			$(oProvSelect).parents('.ripProv').find('.ripError').remove();
			
			if (oProvSelect.value<1)
			{
					$(oCityTR).hide();
			}
			else
			{		
					$(oCityTR).show();
			}
			getCity('',oProvSelect.value,2,oCityTR);
		}
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
		function changeCity(oCitySelect)
		{
			//var oProvTR=oProvSelect.parentNode.parentNode;  //grab the actual TR element	
			
			var oNewCityTR=$(oCitySelect).parents('.ripCity').siblings('.ripNewCity');	
					
			$(oCitySelect).parents('.ripCity').find('.ripError').remove();					
					
			if (oCitySelect.value==-2)
			{
				$(oNewCityTR).show();
			}
			else
			{
				$(oNewCityTR).hide();
			}
			//getCity('',oCitySelect.value,2);									
		}		



    rn.pclone = function(oR,box) {
		var oT,str;
		
		oT=$(oR).parents('.rad1');
		str=$(oT).find("."+box).val();
		//str=$(oT).find(".riderbox").val();
		//alert(str);
		oT=$(oT).next();
		
		while($(oT).html()!=null)
		{
		
			$(oT).find("."+box).val(str);
			oT=$(oT).next();
		}
		return;
	};		


    rn.lclone = function(oR) {
		var oT,str;

		oT=$(oR).parents('.rad1');
		str=$(oT).find(".loctable").html();
		citystr=$(oT).find("#locationcity").val();
		provstr=$(oT).find("#locationprovince").val();
		countrystr=$(oT).find("#locationcountry").val();
		newcitystr=$(oT).find("#newcityid").val();

		while($(oT).html()!=null)
		{
		//alert($(oT).html());
		$(oT).find(".loctable").html(str);
		$(oT).find("#locationcity").val(citystr);
		$(oT).find("#locationprovince").val(provstr);
		$(oT).find("#locationcountry").val(countrystr);
		$(oT).find("#newcityid").val(newcitystr);	
		//alert(str);
		oT=$(oT).next();
		}
		return;
	};	
