var sUrl = 'podcastAjax.php?';

var searchList	= '';

var tabName		= 'All Results';

var sortBy		= '';

var locationWindow = window.location.pathname+window.location.search+window.location.hash;



function getMainNewPodcastAjaxData(tab, type){



	$('div.podcast_topleftbox_m').prepend('<span class="icpl_loading">loading..</span>');

	url	= sUrl + "sAction=main&tab="+tab+"&type="+type;

	$.get(url, {

        time: Math.random()

    }, function(data){

       $('#newPodcastDivId').html(data);

    });



}	



$(document).ready(function()

{

	$("#search_podcast_all").click(function()				

	{

		

		var checked_status = this.checked;

		$("input[@class=ipcl_srh_chkbx]").each(function()

		{

			this.checked = checked_status;

		});

	});



	$("#ipcl_podcast_search_button").click(function()				

	{

		

		var n = $("input:checked").length;

		

		if(n==0)

		{

//			$("input[@name=keyword]").val(this.innerHTML);

			

			$("input[@class=ipcl_srh_chkbx]").each(function()

			{

				this.checked = true;

			});

		}

		

		document.getElementById('frm_search').submit();

	});



	$(".PopularSearchId").click(function()				

	{

		$("input[@name=keyword]").val(this.innerHTML);

		

		$("input[@class=ipcl_srh_chkbx]").each(function()

		{

			this.checked = true;

		});

		document.getElementById('frm_search').submit();

	});



	$(".seeAllTag").click(function()				

	{

		$("input[@class=ipcl_srh_chkbx]").each(function()

		{

			this.checked = true;

		});

		document.getElementById('frm_search').submit();

	});





});





function listingPodcastAjax(tab){

	

	showLoaderImg('podcast_search_loader_div');

	//$('#podcast_search_loader_div').prepend('<span class="icpl_loading">loading..</span>');

	for(var k=1; k<8; k++){

		if(k==1 && document.getElementById('resultTab' + k))

			document.getElementById('resultTab' + k).className = 'tabs1_1';

		else if(k==2  && document.getElementById('resultTab' + k))

			document.getElementById('resultTab' + k).className = 'tabs1_1';

		else if(k==3 && document.getElementById('resultTab' + k))

			document.getElementById('resultTab' + k).className = 'tabs1_1';

		else if(k==4 && document.getElementById('resultTab' + k))

			document.getElementById('resultTab' + k).className = 'tabs1_1';

		else if(k==5 && document.getElementById('resultTab' + k))

			document.getElementById('resultTab' + k).className = 'tabs1_1';

		else if(k==6 && document.getElementById('resultTab' + k))

			document.getElementById('resultTab' + k).className = 'tabs1_1';

		else if(k==7 && document.getElementById('resultTab' + k))

			document.getElementById('resultTab' + k).className = 'tabs1_1';

		else

			continue;

	}



	tab.className = tab.className + " tabs1_1_Active";

	tabName	= tab.innerHTML;

	var serchData = $(".videofiltertbx").val();

	searchList = 'keyword='+serchData;

	var url = sUrl + 'sAction=search&' + searchList + '&tab=' + tabName;



	$.get(url, {

		time: Math.random()

	}, function(data){

			var data_arr = data.split('^^^^||||^^^^');

			$('#podcast_search_data_div').html(data_arr[0]);

			$('#podcast_paging_id').html(data_arr[1]);

			hideLoaderImg('podcast_search_loader_div');

	});

	



}



function sortListingPodcastAjax(sort){

	//$('#podcast_search_data_div').prepend('<span class="icpl_loading">loading..</span>');

	showLoaderImg('podcast_search_loader_div');

	var serchData = $(".videofiltertbx").val();

	searchList = 'keyword='+serchData;



	var url = sUrl + 'sAction=search&' + searchList + '&tab=' + tabName + '&sortby=' + sort;

	$.get(url, {

		time: Math.random()

	}, function(data){

			var data_arr = data.split('^^^^||||^^^^');

			$('#podcast_search_data_div').html(data_arr[0]);

			$('#podcast_paging_id').html(data_arr[1]);

			hideLoaderImg('podcast_search_loader_div');



	});

	



}



function pagingListingPodcastAjax(page, limit){

		showLoaderImg('podcast_search_loader_div');

	var serchData = $(".videofiltertbx").val();

	searchList = 'keyword='+serchData;



	//$('#podcast_search_loader_div').prepend('<span class="icpl_loading">loading..</span>');

	var url = sUrl + 'sAction=search&' + searchList + '&tab=' + tabName + '&sortby=' + sortBy + '&page=' + page;



	$.get(url, {

		time: Math.random()

	}, function(data){

			var data_arr = data.split('^^^^||||^^^^');

			$('#podcast_search_data_div').html(data_arr[0]);

			$('#podcast_paging_id').html(data_arr[1]);

			hideLoaderImg('podcast_search_loader_div');



	});

	



}



function pagingDetailCommentEpisodeAjax(page, eId){

	$('#podcast_search_data_div').prepend('<span class="icpl_loading">loading..</span>');

	var url = sUrl + 'sAction=comment&id=' + eId + '&page=' + page;

	$.get(url, {

		time: Math.random()

	}, function(data){

			var data_arr = data.split('^^^^||||^^^^');

			$('#icpl_podcast_comment_main_detail' + eId).html(data_arr[0]);

			$('#pagingPodcastComment' + eId).html(data_arr[1]);

	});

	



}



function viewPodcastCommentSection(eId, page)

{

	document.getElementById('postComment' + eId).style.display = "none";

	document.getElementById('viewComment' + eId).style.display = "block";

	var url = sUrl + 'sAction=comment&id=' + eId + '&page=' + page;

	$.get(url, {

		time: Math.random()

	}, function(data){

		$('#viewComment' + eId).html(data);

		document.getElementById('postCommentMsg'+eId).style.display='none';



	});

}



function showPodcastCommentForm(eId, id, hideId){

	var memId = getCookie('memberID');

	

	if(memId == ''){

		showItemEditForm("login_div"); 

		$("#login_div").show().load( 'member.php?action=show_login_form&relocate=' + encodeURIComponent( locationWindow ) );	

	}else{

		document.getElementById(hideId).style.display='none';

		$('div#icpl_comment_heading_div'+ eId).show();

		$('#icpl_comment_heading'+ eId).html('Enter your comments')

		if(document.getElementById(id).style.display=='none')

		{

			$('#icpl_podcast_comment_id'+ eId).val('');

			$('div#'+id).show();

		}else{

			$('div#'+id).hide();

		}



		if(document.getElementById(hideId).style.display=='none' && document.getElementById(id).style.display=='none')

			$('div#icpl_comment_heading_div'+ eId).hide();



	}

}



function postPodcastCommentSection(eId)

{

	var memId = getCookie('memberID');

	

	if(memId == ''){

		showItemEditForm("login_div"); 

		$("#login_div").show().load( 'member.php?action=show_login_form&relocate=' + encodeURIComponent( locationWindow ) );	

	}else{

		document.getElementById('viewComment'+eId).style.display='none';

		document.getElementById('postComment'+eId).style.display='block';

	}

}







function loadPocastComments(eId, id, hideId){

	$('div#commentMsg'+eId).hide();

	pagingDetailCommentEpisodeAjax("1",eId);

	document.getElementById(hideId).style.display='none';

	$('div#icpl_comment_heading_div'+ eId).show();

	$('#icpl_comment_heading'+ eId).html('View Comments')

	if(document.getElementById(id).style.display=='none')

	{

		$('#icpl_podcast_comment_id'+ eId).val('');

		$('div#'+id).show();

	}else{

		$('div#'+id).hide();

	}

		if(document.getElementById(hideId).style.display=='none' && document.getElementById(id).style.display=='none')

			$('div#icpl_comment_heading_div'+ eId).hide();

}



function saveEpisodeComment(eId){

	var postComment = $('#commentText' + eId).val();

	if(postComment == '')

	{

		$('#commentText' + eId).focus();

		$('#podcastInfoDiv' + eId).html('<font color = "red">Please enter text for Comment</font>');

		return false;

	}



        $.ajax({

            type: "GET",

            data: {

                sAction: "addcomment",

                commenttext: postComment,

                id: eId,

                time: Math.random()

            },

            url: sUrl,

            dataType: "string",

            success: function(data){

				var data_arr = data.split('|');

				$('#postCommentMsg'+ eId).show();

				document.getElementById('postCommentMsg' + eId).innerHTML = data_arr[0];

				document.getElementById('postCommentMsg' + eId).style.display = 'block';

				document.getElementById("cmt_episode_num_"+eId).innerHTML=data_arr[1];

				

                $('#commentText' + eId).val('');

				$('#postComment'+eId).hide();

            }

        });



}







function limitCharsPodcastComment(textid, limit, infodiv){



	var text = $('#' + textid).val();

    

    var textlength = text.length;

    

    if (textlength > limit) {

    

        $('#' + infodiv).html('You cannot write more then ' + limit + ' characters!');

        

        $('#' + textid).val(text.substr(0, limit));

        

        return false;

        

    }

    else {

        $('#' + infodiv).html('You have ' + (limit - textlength) + ' characters left.');

        return true;

    }

}





function getCookie(c_name){

	if (document.cookie.length>0) {

		c_start	= document.cookie.indexOf(c_name + "=");

		if (c_start != -1){ 

			c_start	= c_start + c_name.length+1; 

			c_end	= document.cookie.indexOf(";",c_start);

			if (c_end == -1) 

				c_end=document.cookie.length;

			return unescape(document.cookie.substring(c_start,c_end));

		} 

	}

	return "";

}





function searchCityPodcast(link){

		$("input[@name=keyword]").val(link.innerHTML);

		

		$("input[@class=ipcl_srh_chkbx]").each(function()

		{

			this.checked = false;

			if(this.value=='sCity')

				this.checked = true;

		});

		document.getElementById('frm_search').submit();



}



function searchCategoryPodcast(link){

		$("input[@name=keyword]").val(link.innerHTML);

		

		$("input[@class=ipcl_srh_chkbx]").each(function()

		{

			this.checked = false;

			if(this.value=='sGenre')

				this.checked = true;

		});

		document.getElementById('frm_search').submit();



}



function createPodcast(){

	var memId = getCookie('memberID');

	if(memId == ''){

		showItemEditForm("login_div"); 

		$("#login_div").show().load( 'member.php?action=show_login_form&relocate=podcast.php?sAction=create' );	

	}else{

		window.location = ('podcast.php?sAction=create');

	}

}



function subscribePodcast(id){

	var url = sUrl + 'sAction=subscribe&id=' + id;

	var memId = getCookie('memberID');



	if(memId == ''){

		showItemEditForm("login_div"); 

		

		$("#login_div").show().load( 'member.php?action=show_login_form&relocate=' + encodeURIComponent( locationWindow ) );	

		

	}else{

		$.get(url, {

			time: Math.random()

		}, function(data){

				if(data == 1){

					alert("You have already subscribed.");

				}else if(data == 2){

					alert("Your subscription has been succesfully done.");

				}else {

				}

		});

	}

}



function validatePodcastFormData(){

	

	var genre		= $('#txt_podcast_genre').val();

	var title		= $('#txt_podcast_title').val();

	var brief		= $('#txt_podcast_brief').val();

	var description	= $('#txt_podcast_description').val();

	var tags		= $('#txt_podcast_tag').val();



	if(genre == '' || genre == undefined){

		alert('Please choose category.');

		$('#txt_podcast_genre').focus();

		return false;

	}



	if(title == '' || title == undefined){

		alert('Please enter podcast title.');

		$('#txt_podcast_title').focus();

		return false;

	}else if(title.length > 50){

		alert('Title not be more than 50 char.');

		$('#txt_podcast_title').focus();

		return false;

	}



	if(brief == '' || brief == undefined){

		alert('Please enter podcast brief description.');

		$('#txt_podcast_brief').focus();

		return false;

	}else if(brief.length > 100){

		alert('Brief description not be more than 100 char.');

		$('#txt_podcast_brief').focus();

		return false;

	}



	if(description == '' || description == undefined){

		alert('Please enter podcast description.');

		$('#txt_podcast_description').focus();

		return false;

	}else if(description.length > 2000){

		alert('Description not be more than 2000 char.');

		$('#txt_podcast_description').focus();

		return false;

	}



	if(tags == '' || tags == undefined){

		alert('Please enter keywords/tags as comma separated values.');

		$('#txt_podcast_tag').focus();

		return false;

	}else if(tags.length > 200){

		alert('Keywords/tags not be more than 200 char.');

		$('#txt_podcast_tag').focus();

		return false;

	}



	return true;

	

}



function validateEpisodeFormData(){

	

	var title		= $('#txt_podcast_title').val();

	var tags		= $('#txt_podcast_tag').val();

	var description	= $('#txt_podcast_description').val();

	var duration	= $('#txt_podcast_duration').val();

	var term		= document.getElementById('chk_terms').checked;



	if(title == '' || title == undefined){

		alert('Please enter podcast title.');

		$('#txt_podcast_title').focus();

		return false;

	}else if(title.length > 50){

		alert('Title not be more than 50 char.');

		$('#txt_podcast_title').focus();

		return false;

	}



	if(description == '' || description == undefined){

		alert('Please enter podcast description.');

		$('#txt_podcast_description').focus();

		return false;

	}else if(description.length > 2000){

		alert('Description not be more than 2000 char.');

		$('#txt_podcast_description').focus();

		return false;

	}



	if(tags == '' || tags == undefined){

		alert('Please enter keywords/tags as comma separated values.');

		$('#txt_podcast_tag').focus();

		return false;

	}else if(tags.length > 200){

		alert('Keywords/tags not be more than 200 char.');

		$('#txt_podcast_tag').focus();

		return false;

	}





	var file		= TrimString(document.getElementById('txt_file_image').value);

	var ext			= file.substr(file.lastIndexOf('.'));

	ext				= ext.toLowerCase();

	if(ext==".flv" || ext==".mp3"){

		return true;

	}else{

		alert("Please upload flv or mp3 files only.");

		document.getElementById('txt_file_image').focus();

		return false;

	}





	if(duration == '' || duration == undefined){

		alert('Please record episode before uploading.');

		return false;

	}

	if(!term){

		alert('Please confirm term and condition you have read.');

		return false;

	}



	return true;

	

}

function TrimString(sInString)

 {

	sInString = sInString.replace( /^\s+/g, "" );

	return sInString.replace( /\s+$/g, "" );

 }



function getPodcastArchive(id, month, page){

		

	var url = sUrl + 'sAction=archive&id=' + id + '&month=' + month+'&page='+page;



	$.get(url, {

		time: Math.random()

	}, function(data){

		document.getElementById('getEpisodeSection').innerHTML = data;

	});

}



function setPodcastDetailForPlayer(id){

		$('#podcast_player_desc').prepend('<span class="icpl_loading">loading..</span>');

		var url = sUrl + 'sAction=player&id=' + id;

		$.get(url, {

			time: Math.random()

		}, function(data){

			 $('#podcast_player_desc').html(data);

		});



}



/************************** FLASH JAVASCRIPT START **************************/



function delStream(filename){

	return;



}



function getFlashMovieObject(movieName){

	if (window.document[movieName]){

		return window.document[movieName];

	}

	if (navigator.appName.indexOf("Microsoft Internet")==-1){

	if (document.embeds && document.embeds[movieName])

		return document.embeds[movieName];

	}

	else {// if (navigator.appName.indexOf("Microsoft Internet")!=-1) {

		return document.getElementById(movieName);

	}

}

function SendDataToFlashMovie(pid, id) {

	var win = 'height=364,width=600,scrollbars=no,resizable=no,status=no,toolbar=no,menubar=no,location=no';



	winPodcast = window.open("podcastpopup.php?pid="+pid+"&id="+id, "podcast", win);

	return; 

/*	setPodcastDetailForPlayer(id);

	var flashMovie=getFlashMovieObject("podcastplayer");

	flashMovie.sendTextToFlash(id, filename);

	*/

}



function sleep(millis){

	var date = new Date();

	var curDate = null;



	do { curDate = new Date(); } 

		while(curDate-date < millis)

}



function openPodcastPlayer(e){

	return;

	document.getElementById("podcast_player_div").style.display = 'block';

	doSomething(e);

//	sleep(5000);

	return false;

}





function streamLength(duration){

	document.getElementById("txt_podcast_duration").value = duration;

	//alert(duration)

}



function doSomething(e) {

	var posx = 0;

	var posy = 0;

	if (!e) var e = window.event;

	if (e.pageX || e.pageY) 	{

		posx = e.pageX;

		posy = e.pageY;

	}

	else if (e.clientX || e.clientY) 	{

		posx = e.clientX + document.body.scrollLeft

			+ document.documentElement.scrollLeft;

		posy = e.clientY + document.body.scrollTop

			+ document.documentElement.scrollTop;

	}

	if(posx > 550)

		posx = 1000 -posx;

	posy = posy - 40;

	JSFX_FloatDiv("podcast_player_div", posx, posy).flt();

}









/************************** FLASH JAVASCRIPT START **************************/



var ns = (navigator.appName.indexOf("Netscape") != -1);

var d = document;

var px = document.layers ? "" : "px";

function JSFX_FloatDiv(id, sx, sy)

{

	var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];

	window[id + "_obj"] = el;

	if(d.layers)el.style=el;

	el.cx = el.sx = sx;el.cy = el.sy = sy;

	el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};

	el.flt=function()

	{

		var pX, pY;

		pX = (this.sx >= 0) ? 0 : ns ? innerWidth : 

		document.documentElement && document.documentElement.clientWidth ? 

		document.documentElement.clientWidth : document.body.clientWidth;

		pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? 

		document.documentElement.scrollTop : document.body.scrollTop;

		if(this.sy<0) 

		pY += ns ? innerHeight : document.documentElement && document.documentElement.clientHeight ? 

		document.documentElement.clientHeight : document.body.clientHeight;

		this.cx += (pX + this.sx - this.cx)/8;this.cy += (pY + this.sy - this.cy)/8;

		this.sP(this.cx, this.cy);

		//setTimeout(this.id + "_obj.flt()", 40);

	}

	return el;

}





/*

function downloadEpisode(id){

		var url = sUrl + 'sAction=download&id=' + id;



		$.get(url, {

			time: Math.random()

		}, function(data){

			 $('#cmt_episode_num_'+id).html(data);



		});

}

*/



function addContact()

{

	

	if(document.getElementById('title').value=='')	{

		alert('Please enter title');

//		document.getElementById("title").style.backgroundColor = "pink";

		document.getElementById("title").focus();

		return false;

	}

/*

	if(document.getElementById('url').value=='')	{

		alert('Please enter url');

		document.getElementById("url").style.backgroundColor = "pink";

		document.getElementById("url").focus();

		return false;

	}

*/

	if(document.getElementById('editRow').value=='0')	{

		

		var elements = parseInt(document.getElementById('rowsNo').value) +1;

		var addToId = document.getElementById("addElements");

		var addDiv = document.createElement('div');

		var hidenElements;

		var divIdName = "element"+elements;

		addDiv.setAttribute('id',divIdName);



		//adding new table

		var addTable = document.createElement('table');

		addTable.setAttribute('border', '0');

		addTable.setAttribute('cellpadding', '0');

		addTable.setAttribute('cellspacing', '1');

		addTable.setAttribute('width', '100%');

		var tableIdName = "Table"+elements;

		addTable.setAttribute('id', tableIdName);



		var newTR = addTable.insertRow(-1); 

		

		var cell1 = newTR.insertCell(-1);

		cell1.setAttribute('width', '150');

		cell1.setAttribute('style', 'white-space:normal;');

		cell1.setAttribute('title', document.getElementById('title').value);

		var cell2 = newTR.insertCell(-1);

		cell2.setAttribute('width', '150');

		cell2.setAttribute('style', 'white-space:normal;');

		cell2.setAttribute('title', document.getElementById('url').value);

		var cell3 = newTR.insertCell(-1);

		cell3.setAttribute('width', '150');

		cell3.setAttribute('style', 'white-space:normal;');

		var cell4 = newTR.insertCell(-1);



		titleId = "Title"+elements;

		urlId = "Url"+elements;

		windowId = "Window"+elements;



		titleVal = document.getElementById('title').value;

		urlVal = document.getElementById('url').value;

		if(titleVal.length > 20)

		{

			titleVal = titleVal.substr(0, 20)+'...';

		}

		if(urlVal.length > 20)

		{

			urlVal = urlVal.substr(0, 20)+'...';

		}



		cell1.innerHTML = titleVal+'<input type="hidden" name = "Title[]" id= "'+titleId+'" maxlength="255" value= "'+ document.getElementById('title').value +'"/>';



		cell2.innerHTML = urlVal+'<input type="hidden" name = "Url[]" id= "'+urlId+'"  maxlength="255" value= "'+ document.getElementById('url').value +'"/>';

		

		cell3.innerHTML = document.getElementById('window').value+'<input type="hidden" name = "Window[]"  maxlength="255" value= "'+ document.getElementById('window').value +'" id= "'+windowId+'" />';

		

//		cell4.innerHTML = '<input type="button" value="Edit" onClick =\'editContact("'+elements+'");\' /><input type="button" value="Delete" onClick = \'deleteContact("'+divIdName+'");\'/>';

		cell4.innerHTML = '<a href="javascript:void(0)" onClick =\'editContact("'+elements+'");\' />Edit</a> / <a  href="javascript:void(0)" onClick = \'deleteContact("'+divIdName+'");\'/>Delete</a>';

	  

		addDiv.appendChild(addTable);

		

		addToId.appendChild(addDiv);

		

		document.getElementById('rowsNo').value = elements;



	}else{

		var elements = parseInt(document.getElementById('rowId').value);

		

		var divIdName = "element"+elements;

		var divId = document.getElementById(divIdName);

		var tableIdName = "Table"+elements;

		

		addTable = document.getElementById(tableIdName);

		addTable.deleteRow(0);

		

		

		var newTR = addTable.insertRow(-1); 

		var cell1 = newTR.insertCell(-1);

		cell1.setAttribute('width', '150');

		cell1.setAttribute('style', 'white-space:normal;');

		cell1.setAttribute('title', document.getElementById('title').value);

		var cell2 = newTR.insertCell(-1);

		cell2.setAttribute('width', '150');

		cell2.setAttribute('style', 'white-space:normal;');

		cell2.setAttribute('title', document.getElementById('url').value);

		var cell3 = newTR.insertCell(-1);

		cell3.setAttribute('width', '150');

		cell3.setAttribute('style', 'white-space:normal;');

		var cell4 = newTR.insertCell(-1);

		

		titleId = "Title"+elements;

		urlId = "Url"+elements;

		windowId = "Window"+elements;



		titleVal = document.getElementById('title').value;

		urlVal = document.getElementById('url').value;

		if(titleVal.length > 20)

		{

			titleVal = titleVal.substr(0, 20)+'...';

		}

		if(urlVal.length > 20)

		{

			urlVal = urlVal.substr(0, 20)+'...';

		}

		

		cell1.innerHTML = titleVal+'<input type="hidden" name = "Title[]" id= "'+titleId+'" maxlength="255" value= "'+ document.getElementById('title').value +'"/>';



		cell2.innerHTML = urlVal+'<input type="hidden" name = "Url[]" id= "'+urlId+'"  maxlength="255" value= "'+ document.getElementById('url').value +'"/>';

		

		cell3.innerHTML = document.getElementById('window').value+'<input type="hidden" name = "Window[]"  maxlength="255" value= "'+ document.getElementById('window').value +'" id= "'+windowId+'" />';

		

	//	cell4.innerHTML = '<input type="button" value="Edit" onClick =\'editContact("'+elements+'");\' /><input type="button" value="Delete" onClick = \'deleteContact("'+divIdName+'");\'/>';

		cell4.innerHTML = '<a href="javascript:void(0)" onClick =\'editContact("'+elements+'");\' />Edit</a> / <a  href="javascript:void(0)" onClick = \'deleteContact("'+divIdName+'");\'/>Delete</a>';

	  

		divId.appendChild(addTable);

	}

	document.getElementById('title').value ='';

	document.getElementById('url').value ='';

	

	document.getElementById('editRow').value = '0';

	document.getElementById('rowId').value = '0';

}



function deleteContact(divId){

	var d = document.getElementById('addElements');

	var olddiv = document.getElementById(divId);

	d.removeChild(olddiv);

	document.getElementById('editRow').value = '0';

}



function editContact(rowNo){

	

	titleId = "Title"+rowNo;

	urlId = "Url"+rowNo;

	windowId = "Window"+rowNo;

	

	document.getElementById('title').value = document.getElementById(titleId).value;

	document.getElementById('url').value = document.getElementById(urlId).value;

	if(document.getElementById(windowId).value == 'Same Window')

		document.getElementById('window').selectedIndex = 1;

	else

		document.getElementById('window').selectedIndex = 0;



	document.getElementById('editRow').value = '1';

	document.getElementById('rowId').value = rowNo;

}



function locateToEpisodePage(podcastId){

	window.location = "managePoadcast.php?ID="+podcastId+"&amp;action=podcastEpisodes";

}



function validateEpisodeDetails() {

	

	var el = document.getElementById("episode_title");

	if( el.value == '') {

		el.style.backgroundColor = "pink";

		alert("Please enter Title");

		document.getElementById("episode_title").focus();

		return false;

	}

	var e2 = document.getElementById("episode_description");

	if( e2.value == '') {

		e2.style.backgroundColor = "pink";

		alert("Please enter Description");

		document.getElementById("episode_description").focus();

		return false;

	}



	var e3 = document.getElementById("episode_tag");

	if( e3.value == '') {

		e3.style.backgroundColor = "pink";

		alert('Please enter Tags');

		document.getElementById("episode_tag").focus();

		return false;

	}

	if(document.getElementById("add_episode").value == "true")

	{

		var e4 = document.getElementById("imagename");

		if(e4 == "")

		{

			e4.style.backgroundColor = "pink";

			alert('Please select *.flv file to upload');

			document.getElementById("imagename").focus();

			return false;

		}else

		{

		}

	}

	return true;

}



