function init(){
	if(navigator.appVersion.indexOf('Mac')!=-1 && document.all){
		fixmacie("clearthis");
	}
	initsIFR();
	
	if(location.href.indexOf('login.php') != -1){
			document.getElementById('sUsername').focus();
	}
}

function initsIFR(){
	if(sIFR != null && sIFR.replaceElement != null){
		sIFR.replaceElement("h2#h2-sign-in", "/flash/sifr/helveticaneue85heavy.swf", "#FFFFFF",  "#FFFFFF",  "#000000", "transparent", 0, 0, 0, 0);
		sIFR.replaceElement("h3#h3-forgot-password", "/flash/sifr/helveticaneue85heavy.swf", "#FFFFFF",  "#FFFFFF",  "#000000", "transparent", 0, 0, 0, 0);
		sIFR.replaceElement("h3#h3-not-registered", "/flash/sifr/helveticaneue85heavy.swf", "#FFFFFF",  "#FFFFFF",  "#000000", "transparent", 0, 0, 0, 0);
		sIFR.replaceElement("h2", "/flash/sifr/helveticaneue85heavy.swf", "#000000",  "#000000",  "#000000", "transparent", 0, 0, 0, 0);
		sIFR.replaceElement("h3", "/flash/sifr/helveticaneue85heavy.swf", "#000000",  "#000000",  "#000000", "transparent", 0, 0, 0, 0);
	};
};

function getPage(sUrl){
	return sUrl.substr(sUrl.lastIndexOf('/') + 1, sUrl.length);
}

function addBrandsUsed(){
  try{
  	var arrElements = document.getElementsByTagName("input");
  	var txtTotal = (document.getElementsByName("intBrandTotal"))[0];
  	var intTotal = 0;
  
  	for (var i = 0; i < arrElements.length; i++){
    	if(arrElements[i].className == 'brandused_value'){
      	var intCurrent = parseInt(arrElements[i].value);
      	var strCheckName = 'bBrandUsed_' + arrElements[i].name.substr(arrElements[i].name.indexOf("_") + 1);
      	var elmCheck = (document.getElementsByName(strCheckName))[0];
      	
    	  if(!isNaN(intCurrent) && elmCheck.checked)
      	  intTotal += intCurrent;
  	  }
  	}
  	
  	txtTotal.value = intTotal;
  }catch(e){
    alert('exception caught in addBrandsUsed: ' + e);
  }
}


function setRoleType(iRole) {
	document.getElementById('iRoleType').value = iRole;
}

function validateProfile(oForm) {

	//should contain role validation
	return true;
}