//script for open a pop up window for confidential callback
function openPopUpWindow(url,winName,features) {
  window.open(url,winName,features);
}

//print page function that opens the print window.
function printWindow() {
	bV = parseInt(navigator.appVersion);
	if (bV >= 4) window.print();
}

//email an article function
function emailanarticle()
{
	var url=document.URL; 
	var title=document.title; 
	var city = "Canada";
	var script = "bankruptcyscript.js";
	var logo = "homepage05.jpg";
	var domain = "canada.ca";
	var popupwindowurl = "/emailanarticle.php?url="+url+"&city="+city+"&script="+script+"&logo="+logo+"&domain="+domain; 
	openPopUpWindow(popupwindowurl,'','scrollbars=no,resizable=no,width=450,height=350');
}

function validateemailanarticle( form )
{	
	if ( form.sendername.value.length < 1 ) {
		alert( "Please enter your name." );
		form.sendername.focus();
		return false;
	}
	if ( form.receivername.value.length < 1 ) {
		alert( "Please enter receiver's name." );
		form.receivername.focus();
		return false;
	}
	if ( form.receiveremail.value.length < 1 ) {
		alert( "Please enter receiver's email." );
		form.receiveremail.focus();
		return false;
	}

	return true;
}

//bookmark page function
function bookmarkus() 
{
	var bookmarkurl=document.URL; 
	var bookmarktitle=document.title; 
	var popupwindowurl = "http://www.google.com/bookmarks/mark?op=edit&bkmk="+bookmarkurl+"&title="+bookmarktitle;
	openPopUpWindow(popupwindowurl,'','scrollbars=yes,resizable=yes, width=550, height=550, left=0, top=0');
}

//bookmark page function
function bookmarkbloganswer() 
{
	var bookmarkurl="http://www.bankruptcy-canada.ca/blog.htm"; 
	var bookmarktitle="Recent Anonymous Questions and Answers"; 
	var popupwindowurl = "http://www.google.com/bookmarks/mark?op=edit&bkmk="+bookmarkurl+"&title="+bookmarktitle;
	openPopUpWindow(popupwindowurl,'','scrollbars=yes,resizable=yes, width=550, height=550, left=0, top=0');
}

//validate city page form
function validate( form ){
  if ( form.contact.value.length < 1 ) {
    alert( "Please enter an email address or phone number so that we can get back to you with a response to your question." );
    return false;
  }
  if ( form.message.value.length < 1 ) {
    alert( "Please enter a message or question.  Our team is pleased to help." );
    return false;
  }
  return true;
}

function validateCaliforniaCity( form ){
  if ( form.contactname.value.length < 1 ) {
    alert( "Please enter your name so that we can get back to you with a response to your question." );
    return false;
  }
  if ( form.contact.value.length < 1 && form.contactphone.value.length < 1) {
    alert( "Please enter an email address or phone number so that we can get back to you with a response to your question." );
    return false;
  }
  if ( form.message.value.length < 1 ) {
    alert( "Please enter a message or question.  Our team is pleased to help." );
    return false;
  }
  return true;
}
function validateblogquestion(form)
{
	if ( form.subject.value.length < 1 ) 
	{
		alert( "Please enter a subject of your question." );
		form.subject.focus();
		return false;
	}
	if ( form.blogquestionprovince.value == "Select a Province")
	{
		alert( "Please select a province" );
		form.blogquestionprovince.focus();
		return false;
	}
	if ( form.message.value.length < 1 ) 
	{
		alert( "Please enter a question.  Our team is pleased to help." );
		form.message.focus();
		return false;
	}
	return true;
}

//script used on bankruptcy evaluation form
var panes = new Array();

function setupPanes(containerId, defaultTabId) {
		
  // go through the DOM, find each tab-container
  // set up the panes array with named panes
  // find the max height, set tab-panes to that height
  panes[containerId] = new Array();
  var maxHeight = 0; var maxWidth = 0;
  var container = document.getElementById(containerId);
  var paneContainer = container.getElementsByTagName("div")[0];
  var paneList = paneContainer.childNodes;
  for (var i=0; i < paneList.length; i++ ) {
    var pane = paneList[i];
    if (pane.nodeType != 1) continue;
    /*if (pane.offsetHeight > maxHeight) maxHeight = pane.offsetHeight;
    if (pane.offsetWidth  > maxWidth ) maxWidth  = pane.offsetWidth;*/
    panes[containerId][pane.id] = pane;
    pane.style.display = "none";
  }
    /*paneContainer.style.height = maxHeight + "px";
    paneContainer.style.width  = maxWidth + "px";*/
    document.getElementById(defaultTabId).onclick();
}

function showPane(paneId, activeTab) {
  // make tab active class
  // hide other panes (siblings)
  // make pane visible  
  
  //validation for each pane
	var errormessageBills = validateBillsEntries();
	var errormessageAsset = validateAssetsEntries();
	var errormessageIncome = validateIncomeEntries();
  
  if(paneId=="pane3" && (errormessageBills != ""))
  {
		if (errormessageBills != "")
		{
			alert(errormessageBills);
			return false;
		}
  }
  else if(paneId=="pane4" && (errormessageAsset != ""))
  {
	  if (errormessageAsset != "")
	  {
		  alert(errormessageAsset);
		  return false;
	  }
  }
  else if(paneId=="pane5" && (errormessageIncome != ""))
  {
	  if (errormessageIncome != "")
	  {
		  alert(errormessageIncome);
		  return false;
	  }
  }
  else
  {
	   //assign studentdebtonlyandyoung value
	   if(paneId=="pane3" && (errormessageBills == ""))
	  {
		document.frm.studentdebtonlyandyoung.value = "";
		var studentdebtonlyandyoung = checkStudentLoanDebt(); 
		//check if bill section entries are as prefered, if they aren't interupt the evaluation
		if(studentdebtonlyandyoung)
		{
			document.frm.studentdebtonlyandyoung.value = "yes";
		}			
	  }
	  if(paneId=="pane5" && (errormessageIncome == ""))
	  {
		  document.frm.nowage.value = "";
		  document.frm.lowincome.value = "";
		  var nowage = checkIncomeSources();	  
		  var lowincome = checkNetIncome();
	  
		  //check if income section entries are as prefered, if they aren't interupt the process of filling in the evaluation form
		  //by taking user to a different screen
		  if(nowage == true)
		  {
			  document.frm.nowage.value = "yes";	
		  }
		
		  if(lowincome == true)
		  {
			  document.frm.lowincome.value = "yes";	
		  }
	  }
	  
	  switch_tab(activeTab.name);
		for (var con in panes) {
		if (panes[con][paneId] != null) { // tab and pane are members of this container
		  var pane = document.getElementById(paneId);
		  pane.style.display = "block";
		  var container = document.getElementById(con);
		  for (var i in panes[con]) {
			var pane = panes[con][i];
			if (pane == undefined) continue;
			if (pane.id == paneId) continue;
			pane.style.display = "none"
		  }
		}
	  }
  }
  return false;    
}

function validateBillsEntries()
{	
	var numberofcheckeditems = 0;
	var studentloan = false;
	
	var errormessage = "";
	
	
	//checking if user either checked at least one checkbox or at least entered something into the "other debt" field.
	var frm = document.forms[0];
    var bills = document.getElementsByName('bills[]');
	
	for (var i=0; i < bills.length; i++)
	{
		if(bills[i].checked)
		{
			numberofcheckeditems += 1;
			
			if(bills[i].value == "Student loans")
			{				
				studentloan = true;				
				break;
			}
		}				
	}
	
	if(numberofcheckeditems == 0 && trim(document.frm.billsother.value) == "")
	{
		errormessage = "Please tell us what debts you have.";
	}	
	//if student debt is checked, check if age of the debt is specified.
	else if(studentloan == true && (document.frm.studentdebtage.value == "" || document.frm.studentdebtage.value == "select"))
	{
		errormessage ="Please tell us how old your student loan is.";
	}
	else if(document.frm.totaldebt.value == "" || document.frm.totaldebt.value == "select")
	{
		 errormessage ="Please estimate the amount of your total debt.";		 
	}	  
	
	return errormessage;
}

function checkStudentLoanDebt()
{
	var numberofcheckeditems = 0;
	var studentloan = false;
	var otherdebts = "";
	var restricted = false;
	
	//checking if student loans is the only option that is checked
	
	var frm = document.forms[0];
    var bills = document.getElementsByName('bills[]')
	
	for (var i=0; i < bills.length; i++)
	{
		if(bills[i].checked)
		{
			numberofcheckeditems += 1;
			
			if(bills[i].value == "Student loans")
			{				
				studentloan = true;				
				break;
			}
		}					
	}
	
	if(studentloan == true && numberofcheckeditems == 1)
	{
		//checking if there are other debts that user typed into the 'other debts' field
		otherdebts = trim(document.frm.billsother.value);	
		
		if(otherdebts == "")
		{
			//since the student debt is the only debt, check how old it is,
			//- based on the answer the next screen the user will see will be different.
			if(document.frm.studentdebtage.value == "less than 5 years")
			{
				restricted = true;
			}
		}
	}
	
	return restricted;
}


function validateAssetsEntries()
{
	var errormessage = "";	
	var isSelected = false;
	
	for (var i=0; i < document.frm.ownestate.length; i++)
	{
		if(document.frm.ownestate[i].checked)
		{
			isSelected = true;
			break;
		}
	}
	
	if(isSelected == false)
	{
		errormessage = "Please indicate whether or not you own any real estate.";	
	}
	
	return errormessage;
}


function validateIncomeEntries()
{	
	var errormessage = "";
	var numberofcheckeditems = 0;	
	
	//checking if user either checked at least one checkbox or at least entered something into the "other income" field.
	var frm = document.forms[0];
    var incometypes = document.getElementsByName('incometypes[]');
	
	for (var i=0; i < incometypes.length; i++)
	{
		if(incometypes[i].checked)
		{
			numberofcheckeditems += 1;
			break;
		}				
	}
	
	if(numberofcheckeditems == 0 && trim(document.frm.incometypeother.value) == "")
	{
		errormessage = "Please tell us what kinds of income you have.";
	}
	else if(document.frm.monthlyincome.value == "" || document.frm.monthlyincome.value == "select")
	{
		 errormessage = "Please estimate the amount of your total monthly net income.";		 
	}	  
	
	return errormessage;
}

function checkIncomeSources()
{
	var numberofcheckeditems = 0;
	var nowageincome = 0;
	var otherincome = "";
	
	var restricted = false;
	
	var frm = document.forms[0];
    var incometypes = document.getElementsByName('incometypes[]')
	
	//checking if "no-wage" income sources are the only options that are checked
	for (var i=0; i < incometypes.length; i++)
	{
		if(incometypes[i].checked)
		{
			numberofcheckeditems += 1;
			
			if(incometypes[i].value == "Social Assistance or Welfare" 
						   || incometypes[i].value == "Retirement pension"
						   || incometypes[i].value == "Child or spousal support")
			{
				nowageincome += 1;
			}
		}				
	}
	
	if(nowageincome == numberofcheckeditems)
	{
		//checking if there are other types of income that user typed into the 'other income' field
		otherincome = trim(document.frm.incometypeother.value);	
		
		if(otherincome == "")
		{	
			restricted = true;
		}
	}
	
	return restricted;
}

function checkNetIncome()
{
			
	var restricted = false;
	var netincome = document.frm.monthlyincome.value;
	
	//checking if net income is in the prefered range
	if(netincome == "$0 - $1,000")
	{
	 	restricted = true;
	}
	
	return restricted;
}

//show / hide image layers
function switch_tab(objname)
{
	if(objname == "panel1submit")
	{
			showLayer('toptab1on');
			hideLayer('toptab1off');
			
			showLayer('toptab2off');
			hideLayer('toptab2on');
			
			showLayer('toptab3off');
			hideLayer('toptab3on');
			
			showLayer('toptab4off');
			hideLayer('toptab4on');
			
			showLayer('toptab5off');
			hideLayer('toptab5on');
	}
	if(objname == "panel2submit")
	{
			showLayer('toptab1off');
			hideLayer('toptab1on');
			
			showLayer('toptab2on');
			hideLayer('toptab2off');
			
			showLayer('toptab3off');
			hideLayer('toptab3on');
			
			showLayer('toptab4off');
			hideLayer('toptab4on');
			
			showLayer('toptab5off');
			hideLayer('toptab5on');
	}
	if(objname == "panel3submit")
	{
			showLayer('toptab1off');
			hideLayer('toptab1on');
			
			showLayer('toptab2off');
			hideLayer('toptab2on');
			
			showLayer('toptab3on');
			hideLayer('toptab3off');
			
			showLayer('toptab4off');
			hideLayer('toptab4on');
			
			showLayer('toptab5off');
			hideLayer('toptab5on');
	}
	if(objname == "panel4submit")
	{
			showLayer('toptab1off');
			hideLayer('toptab1on');
			
			showLayer('toptab2off');
			hideLayer('toptab2on');
			
			showLayer('toptab3off');
			hideLayer('toptab3on');
			
			showLayer('toptab4on');
			hideLayer('toptab4off');
			
			showLayer('toptab5off');
			hideLayer('toptab5on');
	}
	if(objname == "panel5submit")
	{
			showLayer('toptab1off');
			hideLayer('toptab1on');
			
			showLayer('toptab2off');
			hideLayer('toptab2on');
			
			showLayer('toptab3off');
			hideLayer('toptab3on');
			
			showLayer('toptab4off');
			hideLayer('toptab4on');
			
			showLayer('toptab5on');
			hideLayer('toptab5off');
	}
}

//show hide layers used for panels
function showLayer(layerid)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		document.getElementById(layerid).style.visibility = "visible";
		document.getElementById(layerid).style.display = "block"; 
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		document.all[layerid].style.visibility = "visible";
		document.getElementById(layerid).style.display = "block"; 
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		document.layers[layerid].visibility = "visible";
		document.getElementById(layerid).style.display = "block"; 
	}
}

function hideLayer(layerid)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		document.getElementById(layerid).style.visibility = "hidden";
		document.getElementById(layerid).style.display = "none"; 
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		document.all[layerid].style.visibility = "hidden";
		document.getElementById(layerid).style.display = "none"; 
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		document.layers[layerid].visibility = "hidden";
		document.getElementById(layerid).style.display = "none"; 
	}
}

//validate bankruptcy evaluation form
function validateevaluation(form)
{
	if ( form.firstname.value.length < 1 ) {
		alert( "Please enter your first name." );
		form.firstname.focus();
		return false;
	}
	if ( form.lastname.value.length < 1 ) {
		alert( "Please enter your last name." );
		form.lastname.focus();
		return false;
	}
	if ( form.email.value.length < 1 && form.phone.value.length < 1) {
		alert( "Please enter your email or phone number for us to contact you." );
		form.phone.focus();
		return false;
	}
	if ( form.phone.value.length > 1 && form.bestcalltime.value.length < 1) {
		alert( "Please enter the best time for us to contact you." );
		form.bestcalltime.focus();
		return false;
	}
	if ( form.provincesselect.value == "Select a Province")
	{
		alert( "Please select a province" );
		form.provincesselect.focus();
		return false;
	}
	if ( form.citiesselect.value == "Select a City")
	{
		alert( "Please select a city" );
		form.citiesselect.focus();
		return false;
	}
	if ( form.agreeterm.checked == false ) {
		alert( "Please check the terms and conditions." );
		form.agreeterm.focus();
		return false;
	}
	return true;
}

function setcities() 
{
	//showControl('cityrow');
	//hideControl('cityother');
	var province = document.frm.provincesselect.options[document.frm.provincesselect.selectedIndex].value;
	var city = new Array();
	
	/*if(province == "Select a Province")
	{
		hideControl('cityrow');
		hideControl('cityother');
	}
	*/
	if (province == "Alberta") 
	{
		var city = new Array("Airdrie", "Brooks", "Calgary", "Camrose", "Drumheller", "Edmonton", "Fort McMurray", "Grande Prairie", "Innisfail", "Leduc", "Lloydminster", "Medicine Hat", "Okotoks", "Olds", "Red Deer", "Sherwood Park", "Spruce Grove", "Stony Plain", "St. Albert")
	}
	if (province == "British Columbia") 
	{
		var city = new Array("Abbotsford", "Burnaby", "Campbell River", "Chilliwack", "Comox", "Coquitlam", "Courtenay", "Cranbrook", "Duncan", "East Kootenays", "Kelowna", "Nanaimo", "Parksville", "Port Alberni", "Prince George", "Qualicum", "Richmond", "Surrey", "Vancouver", "Victoria")
	}
	if (province == "Manitoba") 
	{
		var city = new Array("Brandon", "Dauphin", "Portage", "Winnipeg")
	}
	if (province == "New Brunswick") 
	{
		var city = new Array("Fredericton", "Moncton", "Riverview", "Saint John")
	}
	if (province == "Newfoundland and Labrador") 
	{
		var city = new Array("St. John's")
	}
	if (province == "Nova Scotia") 
	{
		var city = new Array("Dartmouth", "Halifax", "Kentville", "Sackville")
	}
	if (province == "Ontario") 
	{
		var city = new Array("Barrie", "Brampton", "Brantford", "Cambridge", "Chatham", "Goderich", "Guelph", "Hamilton Downtown", "Hamilton Mountain", "Kitchener", "Leamington", "London", "Mississauga", "North York", "Ottawa", "Pembroke", "Sarnia", "Scarborough", "St Catharines", "Thunder Bay", "Toronto", "Vaughan", "Windsor", "Yonge and Bloor")
	}
	if (province == "Quebec") 
	{
		var city = new Array("Montreal")
	}
	if (province == "Saskatchewan") 
	{
		var city = new Array("Regina", "Saskatoon")
	}
	
	var numofcities = city.length;
	
	//clear up city selection list and reload cities
	for (var i = (numofcities-1); i >= 1; i--)
	{
         document.frm.citiesselect.options[i]=null;
     }
	 document.frm.citiesselect.length = numofcities+1;
	 document.frm.citiesselect.options[0].text = "Select a City";
	 document.frm.citiesselect.options[0].value = "Select a City";
	 for (i = 0; i < numofcities; i++) 
	{
	  //document.frm.citiesselect.length = numofcities;
	  document.frm.citiesselect.options[i+1].text = city[i];
	  document.frm.citiesselect.options[i+1].value = city[i];
	  //document.frm.citiesselect.selectedIndex = 0;
	}
	document.frm.citiesselect.selectedIndex = 0;
}

function populate_provinces()
{
	document.writeln("<select name=\"provincesselect\" class=\"quoteselect\" onchange=\"setcities();\">");
	document.writeln("<option value=\"Select a Province\">Select a Province</option>");
	document.writeln("<option value=\"Alberta\">Alberta</option>");
	document.writeln("<option value=\"British Columbia\">British Columbia</option>");
	document.writeln("<option value=\"Manitoba\">Manitoba</option>");
	document.writeln("<option value=\"New Brunswick\">New Brunswick</option>");
	document.writeln("<option value=\"Newfoundland and Labrador\">Newfoundland and Labrador</option>");
	document.writeln("<option value=\"Nova Scotia\">Nova Scotia</option>");
	document.writeln("<option value=\"Ontario\">Ontario</option>");
	document.writeln("<option value=\"Quebec\">Quebec</option>");
	document.writeln("<option value=\"Saskatchewan\">Saskatchewan</option>");
	document.writeln("</select>");
}

/*function populate_cities()
{
	document.writeln("<select class=\"quoteselect\" name=\"citiesselect\">");
	// Netscape doesn't seem to like a SELECT menu without any <OPTION> elements
	document.writeln("<option value=\"Select a City\">Select a City</option>");
	// -->
	document.writeln("</select>");
}

*/
//-->

//show hide other city field
function showControl(divId)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		document.getElementById(divId).style.visibility = "visible";		
		if(navigator.appName == "Netscape")
		{
			document.getElementById(divId).style.display = "table-row"; 
		}
		if(navigator.appName == "Microsoft Internet Explorer")
		{
			document.getElementById(divId).style.display = "block"; 
		}
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		document.all[divId].style.visibility = "visible";		
		document.getElementById(divId).style.display = "table-row"; 
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		document.layers[divId].visibility = "visible";		 
		document.getElementById(divId).style.display = "table-row"; 
	}
}

function hideControl(divId)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		document.getElementById(divId).style.visibility = "hidden";
		document.getElementById(divId).style.display = "none"; 
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		document.all[divId].style.visibility = "hidden";
		document.getElementById(divId).style.display = "none"; 
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		document.layers[divId].visibility = "hidden";
		document.getElementById(divId).style.display = "none"; 
	}
}
function exitiframe(self)
{
	if (self != top) top.location = self.location;
}
//check empty fields
function checkemptyfield(form)
{
	if ( form.searchtext.value.length < 1 ) {
		alert( "Please enter a search phrase." );
		form.searchtext.focus();
		return false;
	}
	return true;
}

//check empty search fields
function checksearchbox(form)
{
	if ( form.q.value.length < 1 ) {
		alert( "Please enter a search phrase." );
		form.q.focus();
		return false;
	}
	return true;
}

/* Article Tools */
/*function choosefontsize(size) 
{
	var el = document.getElementById('bca');
	el.style.fontSize = size;
}*/
function choosefontsize(size, resizearea) 
{
	var el = document.getElementById(resizearea);
	el.style.fontSize = size;
}
function ratethispage()
{
	var url=document.URL;
	var popupwindowurl = "/ratethispage.htm?url="+url; 
	//openPopUpWindow(popupwindowurl,'','Toolbar = no, status=no,menubar=no,scrollbars=no,resizable=no,width=530,height=410');

	openPopUpWindow(popupwindowurl,'','');
}
function validateratepage(form)
{
	ratingselected = "";
	
	if( form.features.value.length < 1 )
	{
		alert( "Please tell us your suggestions to improve our site." );
		form.features.focus();
		return false;
	}
	for (i = 0; i <5; i++) 
	{
		if (form.rating[i].checked) 
		{
			ratingselected = form.rating[i].value;
		}
	}
	if ( form.visitfrequency.value == "Please select" && form.features.value.length < 1 && form.recommend.value == "Please choose one" && ratingselected == "" && form.comments.value.length < 1)
	{
		alert( "Please answer at least one question before you submit." );
		form.visitfrequency.focus();
		return false;
	}
	
	return true;
}

function testimonials()
{
	var popupwindowurl = "/testimonials-submit.htm"; 
	openPopUpWindow(popupwindowurl,'','Toolbar = no, status=no,menubar=no,scrollbars=no,resizable=no,width=550,height=300');
}
function validatetestimonials( form )
{	
	if ( form.testimonialssubmit.value.length < 1 ) {
		alert( "Please tell us what you think about our site." );
		form.testimonialssubmit.focus();
		return false;
	}
	return true;
}

//removes leading and trailing spaces in the string passed in.
function trim( string_to_trim )
{ 
  while (string_to_trim.charAt(0) == " ")
  { 
    // remove leading spaces 
    string_to_trim = string_to_trim.substring(1); 
  } 
  
  while (string_to_trim.charAt(string_to_trim.length - 1) == " ")
  { 
    // remove trailing spaces 
    string_to_trim = string_to_trim.substring(0,string_to_trim.length - 1); 
  } 
  
  return string_to_trim; 
}

//validate divorce evaluation form
function validatedivorceevaluation(form)
{
	if ( form.firstname.value.length < 1 ) {
		alert( "Please enter your first name." );
		form.firstname.focus();
		return false;
	}
	if ( form.lastname.value.length < 1 ) {
		alert( "Please enter your last name." );
		form.lastname.focus();
		return false;
	}
	if ( form.email.value.length < 1 && form.phone.value.length < 1) {
		alert( "Please enter your email or phone number for us to contact you." );
		form.phone.focus();
		return false;
	}
	if ( form.phone.value.length > 1 && form.bestcalltime.value.length < 1) {
		alert( "Please enter the best time for us to contact you." );
		form.bestcalltime.focus();
		return false;
	}
	if ( form.provincesselect.value == "Select a Province")
	{
		alert( "Please select a province" );
		form.provincesselect.focus();
		return false;
	}
	if ( form.citiesselect.value == "Select a City")
	{
		alert( "Please select a city" );
		form.citiesselect.focus();
		return false;
	}
	if ( form.agreeterm.checked == false ) {
		alert( "Please check the terms and condition." );
		form.agreeterm.focus();
		return false;
	}
	return true;
}


//email an article function
function openYouTubeVideo()
{
	var popupwindowurl = "/bankruptcy-canada-youtube.htm"; 
	openPopUpWindow(popupwindowurl,'','scrollbars=no,resizable=no,width=500,height=315');
}