// Preload background images
function init(){
 fixPng();
}

// Go Back Buttons
function goBack(){
	history.go(-1)
}

// Update a field based on a value by ID
function updateField(theValue, obj){
	document.getElementById(obj).value = theValue;
}

// Update a field based on a value by ID
function updateFieldDJ(theValue, obj){
	if(theValue){
		document.getElementById(obj).value = 1;
	}else{
		document.getElementById(obj).value = 0;
	}
}

// Updates the DJ section of Application and MyAccount
function updateDJ(theValue, obj, str){
	if (theValue){
		document.getElementById(obj).value = "";
		document.getElementById(obj).focus();
	}else{
		document.getElementById(obj).value = str;
	}
}

// Email Check
function checkMail(theEmail){
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(theEmail)) return true;
	else return false;
}

function valRange(x, startRange, endRange) {
	var isValid = false;
	if ((x.length>=startRange)&&(x.length<=endRange))	{
		isValid = true;
	}
	return isValid;
}

 function fixPng(){
    var arVersion = navigator.appVersion.split("MSIE")
    var version = parseFloat(arVersion[1])
    if ((version >= 5.5) && (version < 7) && (document.body.filters)){
       for(var i=0; i<document.images.length; i++){
          var img = document.images[i];
          var imgName = img.src.toUpperCase();
          if (imgName.substring(imgName.length-3, imgName.length) == "PNG"){
             var imgID = (img.id) ? "id='" + img.id + "' " : "";
             var imgClass = (img.className) ? "class='" + img.className + "' " : "";
             var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
             var imgStyle = "display:inline-block;" + img.style.cssText;
             if (img.align == "left") imgStyle = "float:left;" + imgStyle;
             if (img.align == "right") imgStyle = "float:right;" + imgStyle;
             if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
             var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + img.src + "\', sizingMethod='image');\"></span>"; 
             img.outerHTML = strNewHTML;
             i = i-1;
          }
       }
    }
}
