// Open new window for descriptions

var newWindowK;
var formVolumeK;
var flashtextK = "";
var windGuestTtlK = "";
var windPodcastzK = "";
var newGuestEntry;

function makeNewWindowK(volumeK){
	if (!newWindowK || newWindowK.closed){
		newWindowK = window.open("", "NewWin", "toolbar=no, status=yes, scrollbars, height=350, width=400, left=500, top=250, resizable")
		
		formVolumeK = volumeK;
		newWindowK.focus();
		//force small delay for IE to catch up
		setTimeout("writeToWindowK()", 50);
	}else{
		//window's already open; bring to front
		newWindowK.focus();
	}
}

function writeToWindowK(){
	//var windIntro = "window.document." + formVolume + ".introtitle.value";
	var windIntroK = "window.document.getElementById(formVolumeK).introtitleK.value";
	var windIntroTtlK = eval(windIntroK);
	
	//var windHosts = "window.document." + formVolume + ".hosts.value";
	var windHostsK = "window.document.getElementById(formVolumeK).hostsK.value";
	var windHostsTtlK = eval(windHostsK);
	
	//var windGuest = "window.document." + formVolume + ".guest.value";
	var windGuestK = "window.document.getElementById(formVolumeK).guestK.value";
	var windGuestTtlK = eval(windGuestK);

	
	//no guest zeros out guest entry
	if (windGuestTtlK !== "") {
		newGuestEntry = '<h5>Guests: ' + windGuestTtlK + '<\/h5>';
	}else{
		newGuestEntry = "";
	}
	//window.alert(newGuestEntry);

		//var windGuest = "window.document." + formVolume + ".guest.value";
	var windTopicK = "window.document.getElementById(formVolumeK).topicK.value";
	var windTopicTtlK = eval(windTopicK);
	
	
	
	
	//var windDescrip = "window.document." + formVolume + ".description.value";
	var windDescripK = "window.document.getElementById(formVolumeK).descriptionK.value";
	var windDescripTtlK = eval(windDescripK);
	
	//var windVolume = "window.document." + formVolume + ".volumenumber.value";
	var windVolumeK = "window.document.getElementById(formVolumeK).volumenumberK.value";
	var windVolumeTtlK = eval(windVolumeK);
	

	

	//var windPodcast = "window.document." + formVolume + ".podcast.value";
	var winddateK = "window.document.getElementById(formVolumeK).dateK.value";
	var winddateTtK = eval(winddateK);
	var windPodcastK = "window.document.getElementById(formVolumeK).podcastK.value";
	var windPodcastzK = eval(windPodcastK);
	if (windPodcastzK !== "") {
		newpodcastK = "<a href='#' onclick=\"NewWin=window.open('http://marriage101.net/template/GDSAVideos/GDSA" + winddateTtK + ".php', 'NewWin', 'toolbar=no, status=no, scrollbars=no, width=400, height=275, left=500, top=250'); return false\">";
		newpodcastlinkK = "Watch This Video Podcast Volume " + windVolumeTtlK + "</a>";
		flashtextK = " Now on our Flash Video Podcast Player.";
	}else{
		newpodcastK = "&nbsp;";
		newpodcastlinkK = "&nbsp;";
		flashtextK = "&nbsp;";
	}

	
	
	//assemble content for new window
	var newContentK = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><title>Marriage 101 Radio Podcast Show<\/title><link rel="stylesheet" type="text/css" href="http://marriage101.net/template/css/descriptpop.css"/><\/head>';
	newContentK += '<body><div class="box2top"><h2>' + windIntroTtlK + '<\/h2>';
	newContentK += '<h3>Hosts: ' + windHostsTtlK + '<\/h3>';
	newContentK += newGuestEntry;
	newContentK += '<h5>Topic: ' + windTopicTtlK + '<\/h5>';
	newContentK += '<p>' + windDescripTtlK + '<\/p>';
	newContentK += '<p class="italictxt">' + newpodcastK + newpodcastlinkK + flashtextK + '<\/p>';
	newContentK += '<p class="italictxt">View a list of <a href="http://marriage101.net/template/pages/mediapodtv.php" target="_blank">Starr&rsquo;s Video Podcasts<\/a>. Just click on this link.<\/p>';
	newContentK += '<p class="closewindow"><a href="#" onclick="window.close()">Close Window</a><\/p>';
	newContentK += '<\/div><\/body><\/html>';
	
	//write HTML to new window document
	newWindowK.document.write(newContentK);
	newWindowK.document.close(); // close layout stream
}

