
//var notifymeinnerHTML;
function saveEpisodeRequest(showId){
			//notifymeinnerHTML = document.getElementById('notifyme').innerHTML;		
			document.getElementById('notifyme').innerHTML ="saving............";
           var query = "/saveepisoderequest?sId="+showId;
           jassonReturn = asyncGetJson(query, handleQRes, handleQErr);              
           //timedObject = setTimeout("getShowsOfChannel("+channelId+")",50000);
}

function handleQRes(results){

	var status = results[0]['state'];
	var notifyUrl= document.getElementById("notifyUrl").value;
	var output = "<a href=\"/login.jsp?notifyUrl="+notifyUrl+"\">You must login for this request.</a>"; 
	//var output = "<a href=\"/login.jsp\">You must login for this request.</a>"; 
		if(status == "exist"){
			output = "Your request is already with us. You will notified, when a new episode of this show is made available. ";
			//showFeeds();
		}
		else if(status == "success"){
		    output = "Your request has been saved successfully. You will notified, when a new episode of this show is made available.";
		    //showFeeds();
   		}else if(status == "emailnotexist"){
   			output = "<a href=\"/user/facebookUpdateProfile.jsp?notifyUrl="+notifyUrl+"\">Email Required.</a>";
   		}
   		document.getElementById('notifyme').innerHTML=output;
}

function handleQErr(req){
   //alert('An error occured while fetching the data');
}

function clearTimedObject(){
   if(timedObject)
       clearTimeout(timedObject);
}


function showFeeds(){
	var showName = "Has commented on show <a href='http://www.primetimerewind.tv/"+document.getElementById("notifyUrl").value+"'>"+document.getElementById("showName").value+"</a>";
	if(showName) {
		FB.Facebook.apiClient.friends_get(null, function(result, ex) {
			var comment_data1 ={"commentmsg":showName,"traget":""};
			FB.Connect.showFeedDialog(44161426769, comment_data1, result, null, FB.FeedStorySize.oneLine, FB.RequireConnect.promptConnect,null);
		});
	}
}


/*function changenotifyme(){
	document.getElementById('notifyme').innerHTML = notifymeinnerHTML;
}
	*/ 
