function loadFrames(frame1,page1) {
eval("parent."+frame1+".location='"+page1+"'");
}

function iecheck()
{
if(navigator.appVersion.indexOf('MSIE 6')>=0)document.getElementById('kabbmainbody').style.width = '800px';
}

/* AP News Video script */
function apvDwd(pid,title,pl,t) {
if(!pl) {pl='';}
var w = window.open("http://video.ap.org/vws/search/aspx/ap.aspx?f="+pid+"&g="+title+"&p="+pl+"&t="+t,"apvDwd","width=788,height=598,status=1,scrollbars=1,resizable=1");
}
function flip(iida, iidb) {
 var elea = document.getElementById(iida)
 var eleb = document.getElementById(iidb)
 var h = "hideMe"
 var s = "showMe"
   if (elea.className == h){
      elea.className = s
   } else {
      elea.className = h
      }
   if (eleb.className == h){
      eleb.className = s
   } else {
      eleb.className = h
      }
}
function classoggle(tag, classa, classb) {
   if (tag.className==classa){
      tag.className=classb;
   } else {
      tag.className=classa;
}
}
function xxxvisoggle(index, me) {
 var d = document.getElementById(index);
 var openPicture ="/images/minus.gif";
 var closePicture ="/images/plus.gif";
 classoggle(d, 'hideMe', 'showMe');
   if (me!=undefined) {
      if (me.src == closePicture){
         me.src = openPicture; }
      else {
         me.src = closePicture;
      }
    }
}


var oldtag = '';

function xvisoggle(index) {
 var tag = document.getElementById(index);
   if (tag.className=='hideMe')
	{
		tag.className='showMe';
	}
   else {
		tag.className='hideMe';
		tag = '';
	}

		oldtag.className='hideMe';
		oldtag = tag;
}


/* HEADLINES DISPLAY */
var oldtag = '';

function visoggle(index,pic,pictitle) {
 var tag = document.getElementById(index);
 var picture = document.getElementById('photodisplay');
 var picturetitle = document.getElementById('phototitledisplay');
 
   if (tag.className=='hideMe')
	{
		tag.className='showMe';
	}
   else {
		tag.className='hideMe';
		tag = '';
	}

		oldtag.className='hideMe';
		oldtag = tag;

/*
 classoggle(d, 'hideMe', 'showMe');
   if (me!=undefined) {
      if (me.src == closePicture){
         me.src = openPicture; }
      else {
         me.src = closePicture;
      }
    }
*/
}


function collapseAll(start, exp) {
if (exp == 1) {
   var newClass = 'showMe';
   var newPic = openPicture;
   var oldPic = closePicture;
  } else {
   var newClass = 'hideMe';
   var newPic = closePicture;
   var oldPic = openPicture;
  }
 var allDivs = document.getElementsByTagName('div');
 var allImgs = document.getElementsByTagName('img');
 for (i=0; i < allDivs.length; i++) {
   if (allDivs[i].id.indexOf(start) > -1) {
    allDivs[i].className = newClass
   }
 }
 for (i=0; i < allImgs.length; i++) {
    if (allImgs[i].src == oldPic) {
      allImgs[i].src = newPic
    }
 }
}

	// show / hide an area
	function toggle ( target )
	{
	  if (document.getElementById)
	  {
			target = document.getElementById( target );
			if (target.style.display == "none")
			{
				target.style.display 	= "block";
			}
			else
			{
				target.style.display 	= "none";
			}
	  }
	}
	
function autoResize(id){
    var newheight;

    if (!window.opera && !document.mimeType && document.all && document.getElementById){
        newheight=document.getElementById(id).contentWindow.document .body.offsetHeight;
    }else if(document.getElementById){
        newheight=document.getElementById(id).contentWindow.document .body.scrollHeight;
    }

    document.getElementById(id).height= (newheight + 16) + "px";
}

	function checkEmail(email) {
		if (email.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi) == false) {
			alert("invalid email");
			return false;
		} else {
			return true;
		}
	}

	// load in parent for IFRAME
	function lip(place)
	{
		parent.location = place;
	}

	function popup(url,w,h)
	{
		window.open(url,"popup_pd","fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=auto,resizable=yes,directories=no,location=no,width="+w+",height="+h).focus();
		return false;
	}


	function yousure()
	{
		var where_to= confirm("Are you sure?");

		if (where_to == true) {
			document.getElementById('yousure').value = '1';
		} else if (where_to == false) {
			document.getElementById('yousure').value = '0';
		}
	}



function switchAd(zone) {
}

  function playheadlineFlashVideo(vidId,vdivid) {
	var videoPaneID = document.getElementById(vdivid);
         videoPaneID.style.display='block';
         videoPaneID.innerHTML='';
	var vidstring ='<center><table border=0><tr><td align="center"><object type="application/x-shockwave-flash" data="/template/flashplayers/xmlstreamplayer.swf?xmlfile=/vod/flashheadlines/'+vidId+'.xml" width="320" height="260" wmode="solid">';
	vidstring +='<param name="movie" value="/template/flashplayers/xmlstreamplayer.swf?xmlfile=/vod/flashheadlines/'+vidId+'.xml" />';
	vidstring +='</object></td></tr></table></center>';
	videoPaneID.innerHTML+=vidstring;
}



  function playFlashVideo(vidId) {
	var videoPaneID = document.getElementById('videoPane');
      if (vidId=='CLEAR') {
         videoPaneID.style.display='none';
         videoPaneID.innerHTML=''; 
      }
      else {
         videoPaneID.style.display='block';
         videoPaneID.innerHTML='<table border=0><tr><td align="right"><a href="javascript:playFlashVideo(\'CLEAR\')"><img src="http://kabb.com/vod/images/delete.gif" border="0" align="right" style="background: #ffffff"></a></td></tr>';
	var vidstring ='<tr><td><object type="application/x-shockwave-flash" data="/template/flashplayers/xmlstreamplayer.swf?xmlfile=/vod/flash/'+vidId+'.xml" width="320" height="260" wmode="solid">';
	vidstring +='<param name="movie" value="/template/flashplayers/xmlstreamplayer.swf?xmlfile=/vod/flash/'+vidId+'.xml" />';
	vidstring +='<embed src="/template/flashplayers/xmlstreamplayer.swf?xmlfile=/vod/flash/'+vidId+'.xml&autostart=true" width="320" height="260" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	vidstring +='</object></td></tr></table>';
	videoPaneID.innerHTML+=vidstring;
	}
}


 
  function playVideoAI(vidId) {
   vidPaneID = document.getElementById('videoPane');
      if (vidId=='CLEAR') {
         vidPaneID.style.display='none';
         vidPaneID.innerHTML=''; 
      } else {
         vidPaneID.style.display='block';
         vidPaneID.innerHTML='<table border=0><tr><td align="right"><a href="javascript:playVideoAI(\'CLEAR\')"><img src="http://kabb.com/vod/images/delete.gif" border="0" align="right" style="background: #ffffff"></a></td></tr>';
	var vidstring ='<tr><td><OBJECT id="MediaPlayer" width="320" height="312" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">';
	vidstring +='<param name="URL" value="http://'+vidId+'"> <param name="FileName" value="http://'+vidId+'">';
	vidstring +='<param name="ShowPositionControls" value="1">';
	vidstring +='<param name="ShowAudioControls" value="1">';
	vidstring +='<param name="ShowCaptioning" value="0">';
	vidstring +='<param name="ShowStatusBar" value="1">';
	vidstring +='<param name="ShowControls" value="1">';
	vidstring +='<param name="ShowGotoBar" value="0">';
	vidstring +='<param name="ShowDisplay" value="0">';
	vidstring +='<param name="ShowTracker" value="1">';
	vidstring +='<param name="TransparentAtStart" value="0">';
	vidstring +='<param name="AnimationAtStart" value="1">';
	vidstring +='<param name="stretchToFit" value="false">';
	vidstring +='<param name="uiMode" value="full">';
	vidstring +='<param name="AutoStart" value="true">';
	vidstring +='<EMBED type="application/x-mplayer2" src="http://'+vidId+'" id="MediaPlayer" name="MediaPlayer" ';
	vidstring +='height="312" width="320" ';
	vidstring +='ShowPositionControls="1" ';
	vidstring +='ShowAudioControls="1" ';
	vidstring +='ShowCaptioning="0" ';
	vidstring +='ShowStatusBar="1" ';
	vidstring +='ShowControls="1" ';
	vidstring +='ShowGotoBar="0" ';
	vidstring +='ShowDisplay="0" ';
	vidstring +='ShowTracker="1" ';
	vidstring +='AllowChangeDisplaySize="1" ';
	vidstring +='TransparentAtStart="0" ';
	vidstring +='DisplaySize="4" ';
	vidstring +='PreviewMode="0" ';
	vidstring +='uiMode="full" ';
	vidstring +='stretchToFit="false" ';
	vidstring +='AutoStart="true"></EMBED></OBJECT></td></tr></table>';
         vidPaneID.innerHTML+=vidstring;
      }
   }
   

function OpenSTPage(url)
{
	window.open(url,'StarTrekEnterprise','scrolling=no,scrollbars=no,resizable=no,toolbar=no,width=960,height=710');
}

function OpenNewsPage(url)
{
	window.open(url,'KABBNewsArchive','scrolling=yes,scrollbars=yes,resizable=yes,toolbar=no,width=700,height=600');
}
function WebLinks(url)
{
	window.open(url,'KABBWebLinks');
}
function Contest(url)
{
	window.open(url,'Contest','scrolling=auto,scrollbars=auto,resizable=yes,toolbar=no,width=600,height=600');
}
function SA411()
{
	window.open('http://sa411.myfoxsa.com','SA411','scrolling=yes,scrollbars=yes,resizable=yes,toolbar=no,width=650,height=700');
}

function VideoWindow(url)
{
	window.open(url,'Video_Player','scrolling=no,scrollbars=no,resizable=no,toolbar=no,width=728,height=494');
}

function wwflipme(flipme) {
 var ww1ID = document.getElementById('ww1');
 var ww2ID = document.getElementById('ww2');
 var ww3ID = document.getElementById('ww3');
 var ww4ID = document.getElementById('ww4');
 var hide = "none";
 var show = "block";
   if (flipme == '1'){
	if (ww1ID.style.display == show) {
		ww1ID.style.display = show;
	}
	else {
		ww1ID.style.display = show;
		ww2ID.style.display = hide;
		ww3ID.style.display = hide;
		ww4ID.style.display = hide;
	}
   }
   if (flipme == '2'){
	if (ww2ID.style.display == show) {
		ww2ID.style.display = show;
	}
	else {
		ww1ID.style.display = hide;
		ww2ID.style.display = show;
		ww3ID.style.display = hide;
		ww4ID.style.display = hide;
	}
   }
   if (flipme == '3'){
	if (ww3ID.style.display == show) {
		ww3ID.style.display = show;
	}
	else {
		ww1ID.style.display = hide;
		ww2ID.style.display = hide;
		ww3ID.style.display = show;
		ww4ID.style.display = hide;
	}
   }
   if (flipme == '4'){
	if (ww4ID.style.display == show) {
		ww4ID.style.display = show;
	}
	else {
		ww1ID.style.display = hide;
		ww2ID.style.display = hide;
		ww3ID.style.display = hide;
		ww4ID.style.display = show;
	}
   }
   if (flipme == '10'){
		ww1ID.style.display = hide;
		ww2ID.style.display = hide;
		ww3ID.style.display = hide;
		ww4ID.style.display = hide;
   }

}