var xmlHttp



function showProvince(str)
{
if (str.length==0)
  { 
  document.getElementById("ID_showProvince").innerHTML="";
  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="http://www.capic.ca/showItem.php";
url=url+"?Country="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChangedProvince;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateChangedProvince() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("ID_showProvince").innerHTML=xmlHttp.responseText;
}
}




function showCity(str)
{
if (str.length==0)
  { 
  document.getElementById("ID_showCity").innerHTML="";
  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="http://www.capic.ca/showItem.php";
url=url+"?Province="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChangedCity;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateChangedCity() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("ID_showCity").innerHTML=xmlHttp.responseText;
}
}

function showProvince_fr(str)
{
if (str.length==0)
  { 
  document.getElementById("ID_showProvince").innerHTML="";
  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="http://www.capic.ca/showItem.php";
url=url+"?Country="+str+"&lang=fr";
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChangedProvince;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateChangedProvince() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("ID_showProvince").innerHTML=xmlHttp.responseText;
}
}




function showCity_fr(str)
{
if (str.length==0)
  { 
  document.getElementById("ID_showCity").innerHTML="";
  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="http://www.capic.ca/showItem.php";
url=url+"?Province="+str+"&lang=fr";
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChangedCity;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateChangedCity() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("ID_showCity").innerHTML=xmlHttp.responseText;
}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}








function fix_phone(str, inputname)
{
	var i = j = 0;
	var new_str = final_num = "";

	str = '' + str;
	splitstring = str.split(" ");
	str="";
	for(i = 0; i < splitstring.length; i++)
		str += splitstring[i];


	for (i = 0; i < str.length; i++)
    	{   
		var c = str.charAt(i);
        	if (((c >= 0) && (c < 10))) {
			new_str += c.toString();
			
		}
       	}

	if (new_str.length == 11)
		final_num = new_str.charAt(0) + "-" + new_str.charAt(1) + new_str.charAt(2) + new_str.charAt(3) + "-" + new_str.charAt(4) + new_str.charAt(5) + new_str.charAt(6) + "-" + new_str.charAt(7) + new_str.charAt(8) + new_str.charAt(9) + new_str.charAt(10);
	else if(new_str.length == 10)
		final_num = new_str.charAt(0) + new_str.charAt(1) + new_str.charAt(2) + "-" + new_str.charAt(3) + new_str.charAt(4) + new_str.charAt(5) + "-" + new_str.charAt(6) + new_str.charAt(7) + new_str.charAt(8) + new_str.charAt(9);
	else 
		final_num = new_str;


	if (inputname == "busphone")
		document.regform.busphone.value = final_num;
	else if (inputname == "fax")
		document.regform.fax.value = final_num;
	else if (inputname == "mobilephone")
		document.regform.mobilephone.value = final_num;
	else if (inputname == "homephone")
		document.regform.homephone.value = final_num;

}


function fix_name(str, inputname)
{
	str_1stchar = str.charAt(0);
	str_1stchar = str_1stchar.toUpperCase();

	str_rest = str.substring(1,str.length);
	str_rest = str_rest.toLowerCase();

	str = str_1stchar + str_rest;

	if (inputname == "firstName")
		document.regform.firstName.value = str;
	else if (inputname == "lastName")
		document.regform.lastName.value = str;


}




function writeflash1() {

document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="735" height="92">');
document.write('<param name="movie" value="images/ads/nbf2.swf"> ');
document.write('<param name="quality" value="high">');
document.write('<param name="menu" value="false">');
document.write('<!--[if !IE]> <-->');
document.write('<object data="images/ads/nbf2.swf" width="735" height="92" type="application/x-shockwave-flash">');
document.write('<param name="quality" value="high">');
document.write('<param name="menu" value="false">');
document.write('<param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer">');
document.write('FAIL (the browser should render some flash content, not this).');
document.write('</object>');
document.write('<!--> <![endif]-->');
document.write('</object>');

}