/* Copyright (c), 2004-2008 SustainableCircles Corp. All rights reserved. */
(function() {
SL = {};
SL.util = {
addListener: function() {
if (window.addEventListener) {
return function(el, type, fn) {
el.addEventListener(type, fn, false);
};
} else if (window.attachEvent) {
return function(el, type, fn) {
el.attachEvent('on'+type, this._IE6Listener_(fn));
};
} else {
return function(el, type, fn) {
el['on'+type] = fn;
}
}
}(),
_IE6Listener_: function(fn){
return function(e){
e.target = e.srcElement;
fn.call(e.target, e);
}
},
removeListener: function(element, type, listener)
{
if(!element)
return false;
if(window.removeEventListener)	{ // Standard
element.removeEventListener(type, listener, false);
return true;
} else if(window.detachEvent) { // IE
element.detachEvent('on' + type, listener);
return true;
} else return false;
},
stopEvent: function(evt) {
if (!evt) evt = window.event;
(evt.stopPropagation) ? evt.stopPropagation() : evt.cancelBubble = true;
(evt.preventDefault) ? evt.preventDefault() : evt.returnValue = false;
return false;
},
hasClass: function(el, className) {
return el.className.match(new RegExp('(\\s|^)' + className + '(\\s|$)'));
},
addClass: function(el, className) {
if (!this.hasClass(el, className)){
el.className =
[el.className, className].join(' ');
}
},
removeClass: function(el, cls) {
if (this.hasClass(el, cls)) {
var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');
el.className=el.className.replace(reg, ' ');
}
},
popupNewWindow: function(url, width, height) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open('"
+ url + "', '" + id
+ "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,width=" + width
+ ",height=" + height
+ ",left = 100,top = 200, resizable=yes');"
);
},
openReusablePopup: function(popupElement, anchorID, xOffset, yOffset) {
this.closeReusablePopup();
this.move(popupElement, anchorID, xOffset, yOffset);
this.openPopup = popupElement;
popupElement.style['visibility'] = 'visible';
},
closeReusablePopup: function(){
if (this.openPopup){
this.openPopup.style['visibility'] = 'hidden';
this.openPopup = null;
}
return false;
},
chElementState: function(el, state) {
if (el) {
el.disabled = state;
}
}
}
})();
function disableElement(state, name) {
var ele = document.getElementsByName(name);
if (ele) {
for(var i=0;i<ele.length;i++) {
ele[i].disabled = state;
}
}
}
function confCancel(url){
var name = confirm("Are you sure you want to cancel your registration? Click Cancel to continue with registration.");
if (name === true &&  url){
window.location.href = url;
}
}
function changeform(){
var form = document.getElementById("form2");
var he=document.getElementById("em");
var pe = document.getElementById("field4");
he.value = pe.value;
form.submit();
}
