document.domain = "latimes.com";
var buzzHeight=0;
function textFieldValidation(field,maxChars) {
	removeArrows(field);
	textCounter(field,maxChars);
}

function removeArrows(field) {
	for (i=0;i<=field.value.length;i++) {
		field.value = field.value.replace("<", "&lt;");
		field.value = field.value.replace(">", "&gt;");
	}
}

function textCounter(field, maxChars) {
	if (field.value.length > maxChars)
		field.value = field.value.substring(0, maxChars);
	document.getElementById('CharCnt').innerText = field.value.length;
}

function sessionAlert() {
	document.getElementById('Warning').style.visibility = 'visible';
}


function iFrameResizer() {	
	
	//if (document.readyState=="complete" && parent.document.readyState=="complete") {

		var isSafari = (navigator.userAgent.indexOf('Safari') != -1);
		var anchorID = location.hash;
		var FrameContentHeight = eval(document.body.scrollHeight);
	
		if (FrameContentHeight < 70) {
			FrameContentHeight = 1420;
		}
		parent.document.getElementById('buzzm').style.height=FrameContentHeight+'px';
		parent.document.getElementById('content').style.height=eval(FrameContentHeight+500)+'px';
		
		if (!isSafari) {
			self.scrollTo(0,0);
			if (anchorID != '') {
				anchorID = anchorID.replace('#','');
				document.getElementById(anchorID).scrollIntoView(true);
				document.getElementById(anchorID).focus();
			}
		}
	//}
}

function iFrameResizer2() {	
    
	if (document.readyState=="complete" && document.frames('buzzmeter').document.readyState=="complete") {

		var isSafari = (navigator.userAgent.indexOf('Safari') != -1);
		var anchorID = location.hash;
		var FrameContentHeight = eval(document.frames('buzzmeter').document.body.scrollHeight);
		
		if (FrameContentHeight < 70) {
			FrameContentHeight = 1420;
		}
		document.getElementById('buzzm').style.height=FrameContentHeight+'px';
		document.getElementById('content').style.height=eval(FrameContentHeight+500)+'px';
		
		/*if (!isSafari) {
				self.scrollTo(0,0);
				if (anchorID != '') {
					anchorID = anchorID.replace('#','');
					document.getElementById(anchorID).scrollIntoView(true);
					document.getElementById(anchorID).focus();
				}
		}*/
	}
}


function refreshBanners() {
	var URL = parent.window.location.toString();
	var Position = URL.indexOf("chet");
	if (Position > -1) {
		parent.document.getElementById('leaderbox').innerHTML = '<iframe style="margin:0;width:728px;height:90px" frameborder="0" scrolling="no" src="http://webapp1.latimes.com/buzzmeter/bannerholder_h.asp" />';
	}
}

function checkDDL(AwardPK) {
	if (document.getElementById('ddlAward').options[document.getElementById('ddlAward').selectedIndex].value != AwardPK) {
		for (i=0;i<document.getElementById('ddlAward').options.length;i++) {
			if (document.getElementById('ddlAward').options[i].value == AwardPK) {
				document.getElementById('ddlAward').options[i].selected = true;
			}
		}
	}
}