var popwin;

function popwindow(url, height, width) {

	var name = "form" ;
	var str = "height=" + height + ",innerHeight=" + height ;
	var strn = "'toolbar=no,scrollbars=no,resizable=no'" ;
	str += ",width=" + width + ",innerWidth=" + width ;

	if ( window.screen ) {
		var ah = screen.availHeight - 30 ;
		var aw = screen.availWidth - 10 ;
		var xc = ( aw - width ) / 2 ;
		var yc = ( ah - height ) / 2 ;
	
		str += ",left=" + xc + ",screenX=" + xc ;
		str += ",top=" + yc + ",screenY=" + yc ;
	}       
	popwin = window.open( url, name, str, strn) ;
}

function getElement(name) {
	var o1 = null;
	if(document.all) {
		o1 = document.all(name);
	}
	else if(document.getElementById) {
		o1 = document.getElementById(name);
	}
	return o1;
}
function showElement(name,displaytype) {
	if(displaytype==undefined){displaytype='';}
	var o1 = null;
	if(document.all) {
		o1 = document.all(name);
	}
	else if(document.getElementById) {
		o1 = document.getElementById(name);
	}
	if(o1!=null) {
		o1.style.display = displaytype;
	}
}
function hideElement(name) {
	var o1 = null;
	if(document.all) {
		o1 = document.all(name);
	}
	else if(document.getElementById) {
		o1 = document.getElementById(name);
	}
	if(o1!=null) {
		o1.style.display = "none";
	}
}
function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
function TACFeaturedEvent(CurrentPage,PageCount,NextOrPrev){
	
	alert("CurrentPage = " + CurrentPage);
	
	var NextPage;
	var PrevPage;
	
	if(getElement("FeaturedEvent" + (CurrentPage + 1))){
		NextPage = CurrentPage + 1;
	}
	else{
		NextPage = 1;	
	}
	
	if(getElement("FeaturedEvent" + (CurrentPage - 1))){
		PrevPage = CurrentPage - 1;
	}
	else{
		PrevPage = PageCount;
	}	
	
	switch(NextOrPrev)
	{
		case "next":
		{
			alert("show " + NextPage);
			hideElement("FeaturedEvent" + CurrentPage);
			showElement("FeaturedEvent" + NextPage);
			break;
		}
		case "prev":
		{
			alert("show " + PrevPage);
			hideElement("FeaturedEvent" + CurrentPage);
			showElement("FeaturedEvent" + PrevPage);
			break;
		}
	}	
}







