var PairVote = PairVote || function() {var vPairVote = {_id: false,_all: false,_layer: false,_home: "/" + (document.location.pathname.match(/^\/sandbox/i) ? "sandbox/" : ""),_checking_email: false,_willing_to: ["pv_willing_to_ndp","pv_willing_to_green","pv_willing_to_liberal","pv_willing_to_conservative","pv_willing_to_bloc","pv_willing_to_communist","pv_willing_to_canadian_action","pv_willing_to_progressive_canadian","pv_willing_to_libertarian","pv_willing_to_animal_alliance","pv_willing_to_pirate","pv_willing_to_christian_heritage"],_requests: [],head: function(pURL, pTag) {if(typeof(PairVote._requests[pURL]) != "undefined") return;var vHead = document.getElementsByTagName('head');if(!vHead) setTimeout('PairVote.head("' + pURL + '", "' + pTag + '")', 10);else {vHead = vHead[0];PairVote._requests[pURL] = document.createElement(pTag);if(pTag == "script") {PairVote._requests[pURL].type = 'text/javascript';PairVote._requests[pURL].src = pURL;} else if(pTag == "link") {PairVote._requests[pURL].rel = 'stylesheet';PairVote._requests[pURL].type = 'text/css';PairVote._requests[pURL].href = pURL;}vHead.appendChild(PairVote._requests[pURL]);}},script: function(pURL) {PairVote.head(pURL, "script");},css: function(pURL) {PairVote.head(pURL, "link");},$: function(pID) {if(PairVote._id) return document.getElementById(pID);if(PairVote._all) return document.all[pID];if(PairVote._layer) return document.layers[pID];return null;},request: function(pURL, pCallback) {var vURL = pURL;if(!vURL.match(/\?/)) vURL += "?";else vURL += "&";vURL += "cb=" + encodeURIComponent(pCallback);vURL += "&_=" + (new Date()).getTime();PairVote.script(vURL);},receive: function(pTask, pResponse) {var vField;if(!pResponse) {alert('Very sorry, a network error occurred. (1)');vField = PairVote.$("pv_postal");if(vField) vField.value = "";} else if(pResponse.error) {alert(pResponse.error);vField = PairVote.$("pv_postal");if(vField) vField.value = "";} else {switch(pTask) {case "ce":var vForm = PairVote.$("pv_signup");if(vForm) {vForm.action = (pResponse.memberID ? "http://votepair.us2.list-manage.com/profile/post" : "http://votepair.us2.list-manage1.com/subscribe/post");vField = PairVote.$("pv_mid");if(pResponse.memberID) {if(!vField) {vField = document.createElement("input");vField.setAttribute("id", "pv_mid");vField.setAttribute("type", "hidden");vField.setAttribute("name", "e");vForm.appendChild(vField);}vField.value = pResponse.memberID;} else if(vField) vField.parentNode.removeChild(vField);/*if(pResponse.membership) {vField = PairVote.$("pv_mid");if(!vField) {vField = document.createElement("input");vField.setAttribute("id", "pv_mid");vField.setAttribute("type", "hidden");vField.setAttribute("name", "e");vForm.appendChild(vField);}vField.value = pResponse.membership["id"];vField = PairVote.$("pv_fburl");if(vField && (vField.value == "")) vField.value = pResponse.membership["merges"]["FBURL"];vField = PairVote.$("pv_twitter");if(vField && (vField.value == "")) vField.value = pResponse.membership["merges"]["TWITTER"];vField = PairVote.$("pv_postal");if(vField && (vField.value == "")) {vField.value = pResponse.membership["merges"]["POSTAL"];PairVote.setRiding({riding: pResponse.membership["merges"]["RIDING"], url: "http://www.electionscanada.ca"});}vField = PairVote.$("pv_willing_to");if(vField && (vField.value == "")) {vField.value = pResponse.membership["merges"]["WILLING_TO"];PairVote.loadWillingToBoxes();}vField = PairVote.$("pv_preferred");if(vField && (pResponse.membership["merges"]["PREFERRED"] != "")) {vField.value = pResponse.membership["merges"]["PREFERRED"];PairVote.changePreferred();}vField = PairVote.$("pv_fname");if(vField && (vField.value == "")) vField.value = pResponse.membership["merges"]["FNAME"];vField = PairVote.$("pv_lname");if(vField && (vField.value == "")) vField.value = pResponse.membership["merges"]["LNAME"];} else if(vField) vField.parentNode.removeChild(vField);*/vField = PairVote.$("pairvote_submit");if(vField) vField.value = (pResponse.memberID ? "Update Profile" : "Register");}PairVote._checking_email = false;PairVote.enableSubmitButton(true);break;case "pc":PairVote.setRiding(pResponse);break;case "rs":var vField = PairVote.$("riding_stats");if(vField) {vField.src = pResponse.url;vField.style.display = "block";}break;default:alert("An error occured: unknown task '" + pTask + "'");break;}}},phoneHome: function(pTask, pParams) {PairVote.request(PairVote._home + "PairVote_services.php?t=" + pTask + "&" + pParams, "PairVote.receive");},init: function() {try {PairVote.loadWillingToBoxes();vField = PairVote.$("pv_host");if(vField) {var vTokens = document.location.search.match(/(?:\?|&)h\=(.+)(?:&|$)/i);if(vTokens) vField.value = vTokens[1];else vField.value = document.location.hostname;}PairVote.changePreferred();if(PairVote.$("pv_postal").value != "") PairVote.getDistrict();} catch(e){}},loadWillingToBoxes: function() {var vField = PairVote.$("pv_willing_to");if(vField && (vField.value != "")) {for(var vLoop = 0; vLoop < PairVote._willing_to.length; vLoop++) {vBox = PairVote.$(PairVote._willing_to[vLoop]);if(vBox) vBox.checked = vField.value.match(new RegExp("(^|,)" + vBox.value + "(,|$)", "i"));}}},setRiding: function(pObject) {var vField = PairVote.$("pv_riding");if(pObject.riding == "") {if((typeof($) != "function") || !pObject.riding_choices) alert("Very sorry, we could not find a riding associated with this postal code. Please contact us: [email protected]");else {var vMenu = PairVote.$("pv_ridings");if(vMenu) {vMenu.options.length = 0;for(var vLoop = 0; vLoop < pObject.riding_choices.length; vLoop++) vMenu.options[vLoop] = new Option(pObject.riding_choices[vLoop], pObject.riding_choices[vLoop]);}$("#dialog-modal").dialog({modal: true});}return;}if(vField) {vField.value = pObject.riding;vField = PairVote.$("pv_electionscanada");if(vField) vField.innerHTML = pObject.riding;vField = PairVote.$("pv_electoral_district_info");if(vField) vField.style.display = "block";PairVote.enableSubmitButton(true);}},enableSubmitButton: function(pEnable) {var vButton = PairVote.$("pairvote_submit");if(vButton) {var vAgree = PairVote.$("pv_agree");vButton.disabled = !pEnable || PairVote._checking_email || (PairVote.$("pv_riding").value == "") || (PairVote.$("pv_willing_to").value == "") || (vAgree && !vAgree.checked);}},getMembership: function() {var vField = PairVote.$("pv_email");if(vField && (vField.value != "")) {PairVote._checking_email = true;PairVote.phoneHome("ce", "e=" + encodeURIComponent(vField.value));}},getDistrict: function() {var vField = PairVote.$("electoral_district_info");if(vField) vField.style.display = "none";PairVote.enableSubmitButton(false);var vPostalCodeField = PairVote.$("pv_postal");if(!vPostalCodeField || (vPostalCodeField.value == "")) return;if(vPostalCodeField.value.match(/^x\:/i)) {PairVote.setRiding({riding: vPostalCodeField.value.replace(/^x\:/i, ""), url: "http://www.electionscanada.ca"});} else {var vTokens = vPostalCodeField.value.match(/^([a-zA-Z][0-9][a-zA-Z]\s?[0-9][a-zA-Z][0-9])(?:\:(.+))?/i);vPostalCodeField.value = vPostalCodeField.value.toUpperCase().replace(/\:/gi, '');vPostalCodeField.value = vPostalCodeField.value.replace(/\s+/gi, '');if(!vTokens || (vTokens.length < 3)) alert("Please enter a valid postal code. (A1A 1A1)");else if(vTokens[2] && (vTokens[2] != "")) {vPostalCodeField.value = vTokens[1].toUpperCase();PairVote.setRiding({riding: vTokens[2], url: "http://www.electionscanada.ca"});} else {PairVote.phoneHome("pc", "pc=" + encodeURIComponent(vPostalCodeField.value));}}},changePreferred: function() {var vField = PairVote.$("pv_preferred");if(vField) {for(var vLoop = 0; vLoop < PairVote._willing_to.length; vLoop++) {var vBox = PairVote.$(PairVote._willing_to[vLoop]);if(vBox) {vBox.disabled = (vBox.value == vField.value);if((vBox.value == vField.value)) vBox.checked = false;}}}},changeWillingTo: function() {var vField = PairVote.$("pv_willing_to");if(vField) {vField.value = "";for(var vLoop = 0; vLoop < PairVote._willing_to.length; vLoop++) {var vBox = PairVote.$(PairVote._willing_to[vLoop]);if(vBox && vBox.checked) {if(vField.value != "") vField.value += ",";vField.value += vBox.value;}}}PairVote.enableSubmitButton(true);},setRidingSelection: function() {$("#dialog-modal").dialog("close");var vMenu = PairVote.$("pv_ridings");if(vMenu) PairVote.setRiding({riding: vMenu.value, url: "http://www.electionscanada.ca"});},validate: function() {var vVoteFor = PairVote.$("pv_preferred");var vField = PairVote.$("pv_willing_to");if(vField && (vField.value == "")) alert("Please select at least one party you would like to vote for in your riding, in exchange for someone else voting " + (vVoteFor ? vVoteFor.value : "") + " in their riding.");else return true;return false;},toggleHelpForField: function(pField, pShow) {if(pField) {var vHelpText = PairVote.$(pField.id + "_help");if(vHelpText) vHelpText.style.display = (pShow ? "block" : "none");}},ridingStats: function() {var vField = PairVote.$("riding_stats");if(vField) vField.style.display = "none";var vPostalCodeField = PairVote.$("vp_stats_pc");if(vPostalCodeField && (vPostalCodeField.value != "")) PairVote.phoneHome("rs", "pc=" + encodeURIComponent(vPostalCodeField.value));}};if(document.getElementById) vPairVote._id = true;else if(document.all) vPairVote._all = true;else if((navigator.appName.indexOf('Netscape') != -1) && (parseInt(navigator.appVersion) == 4)) vPairVote._layer = true;return vPairVote;}(); PairVote.css("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/themes/ui-lightness/jquery-ui.css");PairVote.script("http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js");function pv_boot(){if(typeof(jQuery)=="undefined")setTimeout("pv_boot();",10);else PairVote.script("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js");};pv_boot();try{PairVote.$("pairvote_form_placeholder").innerHTML="

Required fields are bold...

Please note : If you signed up with us for the 2008 election contact us and we will send you an email with an update link for your profile. If you registered before signed up with us for the 2008 election but have a new email address please fill out all of the form. Thank you

Email Address:
The email address at which we can reach you.

Facebook URL:
Giving us your Facebook URL increases your chances of being paired.

Twitter URL:
Giving us your Twitter URL increases your chances of being paired.

Postal code on poll day:
We use your postal code to determine your electoral riding.
Your riding is
Not your riding? Email [email protected]

To elect an MP that is:
I'm willing to vote any of the following:
First Name:
Last Name:
Comments:


Sorry! It looks like that postal code overlaps multiple ridings... Please select your riding in the list below.
Note: If you have received your voting card from Elections Canada, your riding is indicated int he upper-left corner on the back of the card. (the side opposite to the postal label)

Ridings:
";}catch(e){}PairVote.init();