window.onload = initialise;

function initialise()  {
    var x = document.getElementsByTagName('a');
    for (var i=0;i<x.length;i++) {
	if (x[i].getAttribute('type') == 'popup') {
		x[i].onclick = function () {
			return pop(this.href)
		}
		x[i].title += ' (Popup)';
	}
    }
}

/* Developed for Inspirus by Go4 Multimedia to handle
   multiple login types from the one form */
function setLogin(loginType) {
 
    //get the elements we need to manipulate
    usernameFld = document.getElementById('inspirus_username');
    passwordFld = document.getElementById('inspirus_password');
    formElement = document.getElementById('inspirus_login_form');
    fuseactionElement = document.getElementById('inspirus_fuseaction');

    //set our elements depending on the service selected
    if(loginType == 'SMS') {
            usernameFld.name   = 'UserName';
            passwordFld.name   = 'Password';
	    formElement.action = 'http://www.inspirus.com.au/index.cfm/fuseaction/members.main';
    } else if (loginType == 'EmailLite') {
            usernameFld.name   = 'txtEmail';
            passwordFld.name   = 'txtPassword';
	    formElement.action = 'http://lite.e-dm2.com/index.php';
	    fuseactionElement.value = 'login.verify';
    } else if (loginType == 'EmailPro') {
            usernameFld.name   = 'txtEmail';
            passwordFld.name   = 'txtPassword';
	    formElement.action = 'http://inspirus.e-dm2.com';
	    fuseactionElement.value = 'login.redirect';
    }
    document.forms.login_form.submit();
}

function pop(url) {
	newwindow=window.open(url,'name','height=500,width=500');
	if (window.focus) {newwindow.focus()}
	return false;
}
   
function areYouSure(text) {
     return confirm(text);
}

function setActiveStyleSheet(title) {
    var i, a, main;
    for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
        if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
            a.disabled = true;
            if(a.getAttribute("title") == title) a.disabled = false;
        }
    }
}
