/*
	TalkShoe Confidential Information
	Copyright (c) 2005 - 2009 
*/

/*TalkCastMaster Javascript*/

function checkReviews(formName,whichReview,hiddenRating){

	
	var RatingVal=document.getElementById(formName+'1:'+hiddenRating).value;
	var overAllReview=document.getElementById(formName+'1:overallTalkCastReview').value;
	
	if(whichReview=="Overall"){
		document.getElementById('ReviewBubbleRow').style.display = "";
		document.getElementById('ReviewBubbleRowNoReview').style.display = "none";
		document.getElementById('OverallReviewSummary').style.display = "";
	}
	
	if(whichReview=="User"){
		document.getElementById(formName+'4:userReviewText1a').style.display = "";
		document.getElementById(formName+'4:userReviewText1b').style.display = "";
	}


	if(RatingVal=='0.0' && whichReview=="Overall"){
		document.getElementById('ReviewBubbleRow').style.display = "none";
		document.getElementById('ReviewBubbleRowNoReview').style.display = "";
		document.getElementById('OverallReviewSummary').style.display = "none";
	}else if(RatingVal=='0.0' && whichReview=="User"){
		document.getElementById('userReviewsTextDiv').style.display = "";
		document.getElementById('userWriteCommentDiv').style.display = "none";
		document.getElementById(formName+'4:userReviewText1a').style.display = "none";
		document.getElementById(formName+'4:userReviewText1b').style.display = "none";
		if(overAllReview=='0.0'){
			document.getElementById('userReviewsTextDiv').style.display = "none";
		}else{
			document.getElementById(formName+'4:userReviewText2').style.display = "";
		}
	}
}

function checkComments(formName,commentHidden,hiddenUserRating){
	var uRatingVal=document.getElementById(formName+'1:'+hiddenUserRating).value;
	var uCommentVal=document.getElementById(formName+'1:'+commentHidden).value;

	if(uCommentVal.length>0){
		document.getElementById(formName+'6:userReviewCommentText1').style.display = "none";
		document.getElementById(formName+'6:userReviewCommentText2').style.display = "";
	}else if(uRatingVal!='0'){
		document.getElementById(formName+'6:userReviewCommentText1').style.display = "";
		document.getElementById(formName+'6:userReviewCommentText2').style.display = "none";
	}else{
		document.getElementById(formName+'6:userReviewCommentText1').style.display = "none";
		document.getElementById(formName+'6:userReviewCommentText2').style.display = "none";
	}
}

function embedOverallRatingBigSWF(masterId,overallRating){
	var w = '140';
	var h = '28';
	var styleClassID = 'OverallRatingSWF';
	var masterIdVal=document.getElementById(masterId).value;
	var overallRatingVal=document.getElementById(overallRating).value;
	var swfFile='/resources/talkshoe/images/swf/OverallReviewBig.swf';
	var swfCode='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" '
				  + 'width="'+w+'" height="'+h+'" class="'+styleClassID+'" id="'+styleClassID+'">'
				  + '<param name="allowScriptAccess" value="sameDomain" />'
				  + '<param name="movie" value="'+swfFile+'?masterId='+masterIdVal+'&overallRating='+overallRatingVal+'">'
				  + '<param name="quality" value="best" />'
				  + '<param name="wmode" value="transparent" />'
				  + '<param name="bgcolor" value="#FFFFFF" />'
				  + '<embed src="'+swfFile+'?masterId='+masterIdVal+'&overallRating='+overallRatingVal+'" '
				  + 'quality="best" wmode="transparent" bgcolor="#FFFFFF" width="'+w+'" height="'+h+'" '
				  + 'name="'+styleClassID+'" class="'+styleClassID+'" allowScriptAccess="sameDomain" '
				  + 'type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">'
				  + '</embed>'
				  + '</object>';
	document.write(swfCode); 
}

function embedUserRatingBigSWF(masterId,userRating,customVal){
	var w = '156';
	var h = '28';
	var styleClassID = 'UserRatingSWF';
	var masterIdVal=document.getElementById(masterId).value;
	var userRatingVal=document.getElementById(userRating).value;
	var swfFile='/resources/talkshoe/images/swf/UserReviewBig.swf';
	var swfCode='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" '
				  + 'width="'+w+'" height="'+h+'" class="'+styleClassID+'" id="'+styleClassID+'">'
				  + '<param name="allowScriptAccess" value="sameDomain" />'
				  + '<param name="movie" value="'+swfFile+'?masterId='+masterIdVal+'&userRating='+userRatingVal+'&customVal='+customVal+'">'
				  + '<param name="quality" value="best" />'
				  + '<param name="wmode" value="transparent" />'
				  + '<param name="bgcolor" value="#FFFFFF" />'
				  + '<embed src="'+swfFile+'?masterId='+masterIdVal+'&userRating='+userRatingVal+'&customVal='+customVal+'" '
				  + 'quality="best" wmode="transparent" bgcolor="#FFFFFF" width="'+w+'" height="'+h+'" '
				  + 'name="'+styleClassID+'" class="'+styleClassID+'" allowScriptAccess="sameDomain" '
				  + 'type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">'
				  + '</embed>'
				  + '</object>';
	document.write(swfCode); 
}

function embedUserRatingSmallSWF(masterId,dataTable,whichRow,userRating){
	var w = '100';
	var h = '20';
	var styleClassID = 'UserRatingSmallSWF';
	var masterIdVal=document.getElementById(masterId).value;
	var userRatingVal=document.getElementById(dataTable+':'+whichRow+':'+userRating).value;
	var swfFile='/resources/talkshoe/images/swf/UserReviewSmall.swf';
	var swfCode='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" '
				  + 'width="'+w+'" height="'+h+'" class="'+styleClassID+'" id="'+styleClassID+'">'
				  + '<param name="allowScriptAccess" value="sameDomain" />'
				  + '<param name="movie" value="'+swfFile+'?masterId='+masterIdVal+'&userRating='+userRatingVal+'">'
				  + '<param name="quality" value="best" />'
				  + '<param name="wmode" value="transparent" />'
				  + '<param name="bgcolor" value="#FFFFFF" />'
				  + '<embed src="'+swfFile+'?masterId='+masterIdVal+'&userRating='+userRatingVal+'" '
				  + 'quality="best" wmode="transparent" bgcolor="#FFFFFF" width="'+w+'" height="'+h+'" '
				  + 'name="'+styleClassID+'" class="'+styleClassID+'" allowScriptAccess="sameDomain" '
				  + 'type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">'
				  + '</embed>'
				  + '</object>';
	document.write(swfCode); 
}

function goTalkCastTransfer(){	
	var locationID=document.getElementById('masterShowIdForChange').value;
	var goLocation='/talkshoe/web/tscmd/tc/'+locationID;
	
	if(locationID==''){
		location.href='/talkshoe/web/tscmd/home/1'
	}else{
		location.href=goLocation;
	}
}

function changeToTalkcastForNotCustom(){
	//transfer = setTimeout("goTalkCastTransfer()",2500)
	goTalkCastTransfer();
}

function changeToTalkcastForCustom(){
	var locationID=document.getElementById('masterShowIdForCustomChange').value;
	var goLocation='/talkshoe/web/tscmd/tc/'+locationID;
	
	if(locationID==''){
		location.href='/talkshoe/web/tscmd/home/1'
	}else{
		location.href=goLocation;
	}
}

function showTalkCastDescriptionMoreLink(fieldName,shortLength,moreLink){
	var shortenedValue;
	var shortenThis=document.getElementById(fieldName).value;
	var objMoreLink=document.getElementById(moreLink);
	
	if(shortenThis.length>shortLength){
		objMoreLink.style.display = "";
	}else{
		objMoreLink.style.display = "none";
	}
}

function goPastEpisodeHostOptions(num,formName,dataTable,divName){
	rowObject1 = document.getElementById(formName+':'+dataTable+':'+[num]+':'+divName);
	var rowObject1Length = tcpepi1i;
	
	  if(rowObject1.style.display == ""){
		rowObject1.style.display = "none";
	  }else{
	 	for(i=0;i<rowObject1Length;i++){
			document.getElementById(formName+':'+dataTable+':'+i+':'+divName).style.display = "none";
		}
		rowObject1.style.display = "";
	  }
	  
	tip_it(0, '', '', '0','0');

}

function thisDisabled(whatDisabled){
	errorPop("You are only allowed to " +whatDisabled+ " when this Call is enabled.");
}

function printShortUrlSwf(talkcastIdVal){
	var talkcastId = document.getElementById(talkcastIdVal).value;
	var w = "270";
	var h = "23";
	var styleClassID = "ShortUrlSWF";
	var swfFile = "shortUrl.swf";
	var swfDir='/resources/talkshoe/images/swf/';
	var sUrlSwfCode='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" '
				  + 'width="'+w+'" height="'+h+'" class="'+styleClassID+'" id="'+styleClassID+'">'
				  + '<param name="allowScriptAccess" value="sameDomain" />'
				  + '<param name="movie" value="'+swfDir+swfFile+'?domainId='+domainDescriptor+'&masterId='+talkcastId+'">'
				  + '<param name="quality" value="best" />'
				  + '<param name="wmode" value="transparent" />'
				  + '<param name="bgcolor" value="#FFFFFF" />'
				  + '<embed src="'+swfDir+swfFile+'?domainId='+domainDescriptor+'&masterId='+talkcastId+'" quality="best" wmode="transparent" bgcolor="#FFFFFF" width="'+w+'" height="'+h+'" '
				  + 'name="'+styleClassID+'" class="'+styleClassID+'" allowScriptAccess="sameDomain" '
				  + 'type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">'
				  + '</embed>'
				  + '</object>';
	document.write(sUrlSwfCode); 
}
