function see_set_comment_mode(_mode, _recState, _title ) {

	flashcontentDiv = document.getElementById("flashcontent");
	buttonsDiv = document.getElementById("see_buttons_div");
	backButton = document.getElementById("see_back_button");
	wpHome = document.getElementById("see_wp_home");
	wpName = document.getElementById("see_wp_name");

	switch(_recState)
	{
	case "comment":
		commentInput = document.getElementById("comment");
		submitButton = document.getElementById("submit");
		replyId = document.getElementById("comment_reply_ID");
		seeAllowAnonymous = document.getElementById("see_allow_anonymous");
		if (_mode=="videoRec") {

			inreplyto = "";			
			if(commentReplyId==0) {
				postVideouri = document.getElementById("see_post_videouri");
				if(postVideouri.value) {
					inreplyto=postVideouri.value;
				}
				else {
					commentsList = document.getElementById("see_comments_list");
					if(commentsList.value) {
						commentsSplit=(commentsList.value+"").split(";");
						inreplyto = commentsSplit[0].split("=")[1];
					}
				}
			}
			else {
				commentsList = document.getElementById("see_comments_list");
				commentsSplit=(commentsList.value+"").split(";");
				commentsArray = new Array();
				for (var comm in commentsSplit){
					valuesSplit=(commentsSplit[comm]+"").split("=");
					commentsArray[valuesSplit[0]]=valuesSplit[1];
				}
				if(commentsArray[commentReplyId]){
					inreplyto = commentsArray[commentReplyId];
				}
			}
			// resize flash content container
			flashcontentDiv.style.width = "300px";
	 		flashcontentDiv.style.height = "270px";
			
			// push flash widget
			var so = new SWFObject(recorderVersion, "sobject", "300", "270", "9", "#000000");
			so.addVariable("title", _title);
			so.addVariable("recState", _recState);
			so.addVariable("inreplyto", inreplyto);
			so.addVariable("blog_id", wpHome.value);
			so.addVariable("allowAnonymous", seeAllowAnonymous.value);
			so.addVariable("blog_name", wpName.value);
			so.addParam("allowScriptAccess","always");
			so.useExpressInstall('swfobject/expressinstall.swf');
			so.write("flashcontent");
			// hide text comment field
	 		commentInput.style.display = 'none';
	
			// hide submit button
	 		submitButton.style.display = 'none';
	 		
			// hide video comment buttons
	 		buttonsDiv.style.display = 'none';
	
	 		// display back button
	 		backButton.style.display = 'block';

			
		}
		else {
			// remove widget
	 		flashcontentDiv.innerHTML = "";
			flashcontentDiv.style.width = "10px";
	 		flashcontentDiv.style.height = "10px";
	 		
			// show text comment field
	 		commentInput.style.display = 'block';
	
			// show submit button
	 		submitButton.style.display = 'block';
		
			// show video comment buttons
	 		buttonsDiv.style.display = 'block';
	
	 		// display back button
	 		backButton.style.display = 'none';
			
		}
	  break;    

	  case "post":
		postTitleInput = document.getElementById("title");

		if (_mode=="videoRec") {

			// resize flash content container
			flashcontentDiv.style.width = "300px";
	 		flashcontentDiv.style.height = "270px";
			
			// push flash widget
			var so = new SWFObject(recorderVersion, "sobject", "300", "270", "9", "#000000");
			so.addVariable("title", _title);
			so.addVariable("recState", _recState);
			so.addVariable("blog_id", wpHome.value);
			so.addVariable("blog_name", wpName.value);
			so.addVariable("title", postTitleInput.value);
			so.addParam("allowScriptAccess","always");
			so.useExpressInstall('swfobject/expressinstall.swf');
			so.write("flashcontent");
			
			// hide video comment buttons
	 		buttonsDiv.style.display = 'none';
	
	 		// display back button
	 		backButton.style.display = 'block';
			
		}
		else {
			// remove widget
	 		flashcontentDiv.innerHTML = "";
			flashcontentDiv.style.width = "10px";
	 		flashcontentDiv.style.height = "10px";
	 		
			// show video comment buttons
	 		buttonsDiv.style.display = 'block';
	
	 		// display back button
	 		backButton.style.display = 'none';
			
		}
	  
	  
	  break;
	default:
	}

}


function see_play_video(_videoUri, _add) {
	flashcontentDiv = document.getElementById(_videoUri+"_content");
	previewDiv = document.getElementById(_videoUri+"_preview");
	hideDiv = document.getElementById(_videoUri+"_hide");
	showDiv = document.getElementById(_videoUri+"_show");
	
	if(_add) {
		// push flash widget
		var so = new SWFObject(playerVersion, "sotester", "300", "270", "9", "#000000");
		
		so.addVariable("video", _videoUri);
		so.addParam("allowFullScreen", "true");
		so.addParam("allowScriptAccess","always");
		so.useExpressInstall('swfobject/expressinstall.swf');
		so.write(_videoUri+"_content");

		previewDiv.style.display="none";
		hideDiv.style.display="block";
		showDiv.style.display="none";
	}
	else {
		flashcontentDiv.innerHTML="";
		previewDiv.style.display="block";

		//previewDiv.style.display="none";
		hideDiv.style.display="none";
		showDiv.style.display="block";
	}

}
function videoFromRecorder(videoUri, title, url_thumbnail, recState)
{
	if(recState=="comment") {
		commentInput = document.getElementById("comment");
		submitButton = document.getElementById("see_submit");
		//submitForm = document.forms.commentform;
			
		newVideo = title + ' ';
		newVideo += '{seesmic_video:{';
			newVideo += '"url_thumbnail":{"value":"' + url_thumbnail + '"}';
			newVideo += '"title":{"value":"'+title+'&nbsp;"}';
			newVideo += '"videoUri":{"value":"' + videoUri + '"}';
		newVideo += '}}';
	
		seesmicPageTracker._trackPageview("/comment_video.html&blog="+escape(document.domain));
		commentInput.value = newVideo;
		submitButton.click();
		//submitForm.submit.click();
		
		
	}

	if(recState=="post") {
		contentTextArea = document.getElementById("content");
		switchHtmlButton = document.getElementById("edButtonHTML");
		newVideo = '{seesmic_video:{';
			newVideo += '"url_thumbnail":{"value":"' + url_thumbnail + '"}';
			newVideo += '"title":{"value":"'+title+'&nbsp;"}';
			newVideo += '"videoUri":{"value":"' + videoUri + '"}';
		newVideo += '}}';
		if(switchHtmlButton.tagName=="INPUT") {
			switchHtmlButton.click();
		}
		else {
			if(switchHtmlButton.onclick!=undefined) {
				switchHtmlButton.onclick();
			}
		}
		seesmicPageTracker._trackPageview("/post_video.html&blog="+escape(document.domain));
		
		setTimeout("contentTextArea.value += ' '+newVideo+' '", 1000);
		setTimeout("see_set_comment_mode('text','post')", 1500);
				
	}

	
	
	
	return 'posted'
}
function checkCommentReplyChange() {
	replyIdInput = document.getElementById("comment_reply_ID");
	if(replyIdInput) {
		if(replyIdInput.value!=commentReplyId) {
			commentReplyId=replyIdInput.value;
			see_set_comment_mode('text','comment');
		}
	}
}


