//#############################################
//##########  Global vars            ##########
//#############################################

var basePolymediaShowUrl = "http://www.simonaventura.tv/"; // modify this to the value of your installation
var allowedDomains="";

var relJsPath = "res/js/";
var relSwfPath = "res/swf/";
var relImgPath = "res/img/";

var relConfPath = "res/conf/";
var relVideoPath = "res/content/video/rss/";

document.write("<script src='" + "http://svapp.polymedia.it/SVAnalytics/tracing/SessionGenerator?rf=varjs&rnd=" + (Math.floor(Math.random() * 1000)) + "'><\/script>");

//#############################################
//##########  Check flash version    ##########
//#############################################
// Major version of Flash required
var requiredMajorVersion = 10;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 0;

// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
var hasProductInstall = null;
// Version check based upon the values defined in globals
var hasRequestedVersion = null;

var username = ""; 
var nickname = ""; 
//#############################################
//##########  CHIAMATA JSON          ##########
//#############################################

function sendActionDetail() {             
    urlStr = "http://origin.simonaventura.tv/customer/Servizi/internal/checkLogin.jsp?callback=?";
       $.getJSON(urlStr, function(data) {
        	try {
                //$("#username").html(data.username);
                username = data.username;
                nickname = data.username;
                
							if (username != "" && nickname != "")
							{
					     //invia il commento alla pagina jsp di front-end
						    var text = document.getElementById("commentText");
						    var video  = getVideoId();
						    var lingua = getLangCode();
						    // recupero lo username e il nickname con una chiamata JSON
						    var xmlhttp = null;	
						    if (text.value == "")
							    return;
								// var contentData = "idVideo="+escape(video)+"&idUser="+escape(username)+"&idNick="+escape(nickname)+"&idLang="+escape(lingua)+"&idComm="+escape(text.value);
								var browserType = "";
								var contentData = "idVideo="+encodeURIComponent(video)+"&idUser="+encodeURIComponent(username)+"&idNick="+encodeURIComponent(nickname)+"&idLang="+encodeURIComponent(lingua)+"&idComm="+encodeURIComponent(text.value);
								var strUrl = "http://origin.simonaventura.tv/customer/CommentFrontEnd.jsp" ;
								var err = "";
							
							try {
							strUrl = "http://origin.simonaventura.tv/customer/CommentFrontEnd.jsp?";
							strUrl += contentData+"&callback=?";	
				       $.getJSON(strUrl, function(data) {
				        	try {
										//alert("OK");		                
										var resultStr = data.result;
										document.getElementById("commentText").value = "";
										document.getElementById("commentText").value = "Messaggio inviato correttamente";				           
									}     
				    			catch(err) {
										alert (err);
									}
				       }
				       ); 
								
							} 
					catch(err) {
						alert ("(0) "+err);
					}

						}
						else
						{
							document.getElementById("commentText").value = "Per inviare un messaggio occorre essere registrati";
						}     
           }     
    			catch(err) {
						alert (err);
					}
       }
       ); 
}

//#############################################
//##########  Flash creation utils   ##########
//#############################################

var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function PolymediaWidgetControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function PolymediaWidgetGetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			} else if (versionRevision[0] == "b") {
				versionRevision = versionRevision.substring(1);
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = PolymediaWidgetControlVersion();
	}
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function PolymediaWidgetDetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = PolymediaWidgetGetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function PolymediaWidgetAC_AddExtension(src, ext)
{
  var qIndex = src.indexOf('?');
  if ( qIndex != -1)
  {
    // Add the extention (if needed) before the query params
    var path = src.substring(0, qIndex);
    if (path.length >= ext.length && path.lastIndexOf(ext) == (path.length - ext.length))
      return src;
    else
      return src.replace(/\?/, ext+'?'); 
  }
  else
  {
    // Add the extension (if needed) to the end of the URL
    if (src.length >= ext.length && src.lastIndexOf(ext) == (src.length - ext.length))
      return src;  // Already have extension
    else
      return src + ext;
  }
}

function PolymediaWidgetAC_Generateobj(objAttrs, params, embedAttrs) 
{ 
    var str = '';
    if (isIE && isWin && !isOpera)
    {
  		str += '<object ';
  		for (var i in objAttrs)
  			str += i + '="' + objAttrs[i] + '" ';
  		str += '>';
  		for (var i in params)
  			str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  		str += '</object>';
    } else {
  		str += '<embed ';
  		for (var i in embedAttrs)
  			str += i + '="' + embedAttrs[i] + '" ';
  		str += '> </embed>';
    }

    return str;
}

function PolymediaWidgetAC_FL_RunContent(){
	var ret = 
		PolymediaWidgetAC_GetArgs
		(  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
		, "application/x-shockwave-flash"
		);
	return PolymediaWidgetAC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function PolymediaWidgetAC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = PolymediaWidgetAC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "id":
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

function createWidget(idWidget,src,params,width,height,outputFormat)
{
	if (hasProductInstall == null) hasProductInstall = PolymediaWidgetDetectFlashVer(6, 0, 65) ;
	if (hasRequestedVersion == null) hasRequestedVersion = PolymediaWidgetDetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	
	var out = "";
	
	// Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
	if (hasProductInstall && !hasRequestedVersion ) {
	   // MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
	   // This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
	   // DO NOT MODIFY THE FOLLOWING FOUR LINES
	   // Location visited after installation is complete if installation is required
	   var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
	   var MMredirectURL = encodeURI(window.location);
	   document.title = document.title.slice(0, 47) + " - Flash Player Installation";
	   var MMdoctitle = document.title;

	   out = PolymediaWidgetAC_FL_RunContent(
		   "src", "playerProductInstall",
		   "flashVars", "MMredirectURL="+MMredirectURL+"&MMplayerType="+MMPlayerType+"&MMdoctitle="+MMdoctitle+"",
		   "width", "100%",
		   "height", "100%",
		   "align", "middle",
		   "id", "playerProductInstall",
		   "quality", "high",
		   "bgcolor", "#869ca7",
		   "name", "playerProductInstall",
		   "allowScriptAccess","sameDomain",
		   "type", "application/x-shockwave-flash",
		   "pluginspage", "http://www.adobe.com/go/getflashplayer"
	   );
	} else if (hasRequestedVersion) {
	   // if we've detected an acceptable version
	   // embed the Flash Content SWF when all tests are passed
		out = PolymediaWidgetAC_FL_RunContent(
				"src", src,
				"FlashVars", params,
				"width", width,
				"height", height,
				"align", "middle",
				"id", idWidget,
				"quality", "high",
				"name", idWidget,
				"wmode", "transparent",
				"allowFullScreen", "true",
				"allowScriptAccess","always",
				"type", "application/x-shockwave-flash",
				"pluginspage", "http://www.adobe.com/go/getflashplayer"
		);
	 } else {  // flash is too old or we can't detect the plugin
	   out = 'Alternate HTML content should be placed here. '
		 + 'This content requires the Adobe Flash Player. '
		  + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
	 }
	 if (outputFormat != null && outputFormat == "string") {
		 return out;
	 } else {
		 document.write(out);
	 }
}

//************************* VENTURA **************************************+

var DEFAULT_SID = 2; 
var DEFAULT_VID = 0; 

//var PlaylistBaseUrl = "http://dev.simonaventura.tv/contents/playlist/playlist_";  // Sviluppo
var PlaylistBaseUrl = "http://www.simonaventura.tv/contents/playlist/playlist_" ;     // Produzione

//var SezionBaseUrl = "http://dev.simonaventura.tv/contents/section/sectionslist_";  // Sviluppo
var SezionBaseUrl = "http://www.simonaventura.tv/contents/section/sectionslist_" ;     // Produzione

var PlaylistUrl;
var MenuUrl;

var sectionData;
var liveData;

var playlistWidget;
var player;


// EXPOSED BY PAGE

/*
return the HOME section id [it's a constant].
*/
function getDefaultSectionId() {
	return DEFAULT_SID;
}

/*
return the TEASER VIDEO id [it's a constant].
*/
function getDefaultVideoId() {
	return DEFAULT_VID;
}

/*
return the current langCode value;
*/
function getLangCode() {
	return lc;
}

/*
set the current langCode value;
*/
function setLangCode(code) {
	lc = code;
}

/*
return the current sectionId value;
*/
function getSectionId() {
	return sid;
}

/*
set the current sectionId value;
*/
function setSectionId(sectionId) {
	sid = sectionId;
}

/*
return the current videoId value;
*/
function getVideoId() {
	return vid;
}

/*
set the current videoId value;
*/
function setVideoId(videoId) {
	vid = videoId;
	loadVideoComments();
}

/*
create Player widget initialized with the playlistId, playlistUrl, videoId.
*/
function Player(playlistId, playlistUrl, videoId, videoUrl,HorizontalWidgetPlaylisUrl,playlistMenuUrl, writeOnDocument)
{
	this.idWidget = 'VenturaPolymediaShow';
	
	var width = 832;
	var height = 468;
	var flashVars = null;
	var configIdMod = "0";
	var allowedDomains="*";

	flashVars = "configId="+configIdMod;
	flashVars += "&configUrl=" + basePolymediaShowUrl + relConfPath + "VenturaPolymediaShow_" + configIdMod + ".xml";	
	flashVars += "&allowDomains=" + allowedDomains;
	if (playlistId != null)
	{
		flashVars += "&feedId=" + playlistId;
		flashVars += "&feedUrl=" + playlistUrl;
	}
	if (videoId != null)
	{
		flashVars += "&videoId=" + videoId;
		flashVars += "&videoUrl=" + videoUrl;
	}
	if (HorizontalWidgetPlaylisUrl != null)
	{
		
		flashVars += "&relatedFeedUrl=" + HorizontalWidgetPlaylisUrl;
	}
	if (playlistMenuUrl != null)
	{
		flashVars += "&playlistMenuUrl=" + playlistMenuUrl;
	}
	
	if (typeof(playerSessionUUID)!="undefined") 
	{
         flashVars += "&usession=" + playerSessionUUID; 
	}

	
	flashVars += "&background=#CECECE";	
	flashVars += "&backgroundAlpha=100";	
	flashVars += "&background2=#FFFFFF";	
	flashVars += "&background2Alpha=100";
	flashVars += "&autostart=true"; 
	flashVars += "&playerId=1";	
	flashVars += "&baseVideoUrl=" + basePolymediaShowUrl + relVideoPath;
	flashVars += "&swfUrl=" + basePolymediaShowUrl + relSwfPath + "VenturaPolymediaShow.swf";	
	
	if (writeOnDocument != null && (writeOnDocument == false || writeOnDocument == "false")) {
		this.creationString = createWidget(this.idWidget, basePolymediaShowUrl + relSwfPath + 'VenturaPolymediaShow', flashVars, width, height, "string");
	} else {
		createWidget(this.idWidget, basePolymediaShowUrl + relSwfPath + 'VenturaPolymediaShow', flashVars, width, height);
	}
		
	this.pause = function () {
		var _pl = document.getElementById(this.idWidget);
		if (_pl != null && _pl != undefined) _pl.pauseCommand();
	};
	this.resume = function () {
		var _pl = document.getElementById(this.idWidget);
		if (_pl != null && _pl != undefined) _pl.playCommand();
	};
	this.playVideo = function (videoId, autoPlay) {
		var _pl = document.getElementById(this.idWidget);
		if (_pl != null && _pl != undefined && videoId != null)
		{
			_pl.loadVideo(videoId, null, autoPlay);
		}
	};
	this.piuVolume = function (vol) {
		var _pl = document.getElementById(this.idWidget);
		if (_pl != null && _pl != undefined) _pl.moreVolume(vol,1);
	}	
	this.menoVolume = function (vol) {
		var _pl = document.getElementById(this.idWidget);
		if (_pl != null && _pl != undefined) _pl.moreVolume(vol,0);
	}
	
	
	this.cambiaPlaylistMenu = function () {
		var _pl = document.getElementById(this.idWidget);
		if (_pl != null && _pl != undefined )
		{
			MenuUrl	= getMenuPlaylistUrl() ;
			_pl.changePlaylistMenu(MenuUrl);
		}
	};
	
	this.cambiaPlaylist = function () {
		var _pl = document.getElementById(this.idWidget);
		if (_pl != null && _pl != undefined)
		{
			var playlistId = getSectionId() + "_" +getLangCode();
			playlistUrl = getPlaylistUrl();
			_pl.loadPlaylist(playlistId, playlistUrl);
			
			_pl.changePlaylistHorizontal(playlistUrl);
			
		}
	};
	
	this.sincronizza = function (videoId) {
		var _pl = document.getElementById(this.idWidget);
		if (_pl != null && _pl != undefined) _pl.synchronizePlaylist(videoId);
	}
	
	/*
	this.changePlaylistHorizontal = function (playlistURL) {
		var _pl = document.getElementById(this.idWidget);
		if (_pl != null && _pl != undefined && playlistURL != null)
		{
			_pl.changePlaylistHorizontal(playlistURL);
			
		}
	};
	
	this.cambiaVideo = function (videoId, videoUrl, autoPlay) {
		var _pl = document.getElementById(this.idWidget);
		//if (_pl != null && _pl != undefined && videoId != null)
		if (_pl != null && _pl != undefined )
		{
			_pl.loadVideo(videoId, videoUrl, autoPlay);
		}
	};
	*/
	this.cambiaLingua = function (lingua) {
		var _pl = document.getElementById(this.idWidget);
		if (_pl != null && _pl != undefined) _pl.changeLocale(lingua);
	}

}

/*
load the player on the page
*/
function loadPage() {
	setLiveVisibility(false);
	runPlayer();	
}

/*
set "evento live" visibility
 */
function setLiveVisibility(flag)
{
	var element = document.getElementById("box_live");
	if (flag == true || flag == "true")
	{
		element.setAttribute("style", "display: block;");
	}
	else
	{
		element.setAttribute("style", "display: none;");
	}
}

/*
set the current langCode.
request page reload (call loadPage()).
*/
function onLanguageChanged(langCode) {
	if (langCode!=getLangCode()) {
		
		setLangCode(langCode);
		setSectionId(getDefaultSectionId());
		setVideoId(getDefaultVideoId());

		loadPlaylistOnPlayer();	
		
		if (player != null) player.cambiaLingua(langCode);
	}
}


function runPlayer() {
	loadPlaylistOnPlayer();
}

/*
If the widget is present it call changePlaylist(SID) on Playlist widget.

call loadPlaylistOnPlayer(playlistUrl)
*/
function changePlaylist(SectionIDFromMenu) {
	if (player != null && SectionIDFromMenu!=null) {
		setSectionId(SectionIDFromMenu);
		player.cambiaPlaylist();
	
	}
}

/*
playlistId = getLangCode() + "_" + getSectionId();
If the playser is not present it call createPlayer(playlistId, playlistUrl, getVideoId()).
If the player is present it call loadPlaylist(playlistId, playlistUrl, getVideoId()) on Player widget.
*/
function loadPlaylistOnPlayer() {	
	var playlistId = getSectionId() + "_" +getLangCode();
	playlistUrl = getPlaylistUrl();
		MenuUrl	= getMenuPlaylistUrl() ;
		
	var videoId = null;
	if (getVideoId()!=getDefaultVideoId())
		videoId=getVideoId();
	if (player == null) {		
		player = new Player(playlistId, playlistUrl, videoId, null,playlistUrl, MenuUrl,false);		
		var box = document.getElementById("box_Main");
		box.innerHTML = player.creationString;
	} else {	
		
		player.cambiaPlaylist();
		player.cambiaPlaylistMenu();
	}	
	
}

function getPlaylistUrl() {
	return PlaylistBaseUrl + getSectionId()+ "_" +getLangCode()+".rss";
}

function getMenuPlaylistUrl() {
	return SezionBaseUrl +getLangCode()+".rss";
}
/*
setVideoId(videoId).
call synchronizePlaylist(videoId) on Playlist widget.
*/
function synchronizePlaylist(videoId) {
	
	setVideoId(videoId);
	if (player != null) player.sincronizza(videoId);
	
}

function sendComment() {
    sendActionDetail();	
}

function InserisciHtml(pUrl)
{
   
	//inserisce dinamicamente il codice HTML nella pagina statica
	var stato = "KO";
	ret = $.ajax({ 
		url: pUrl,
		dataType: "html",
		context: document.body,
		complete: function()
		{
			if (ret.readyState  == 4 && ret.status  == 200)
			{
				
				$('#commentDiv').empty();
				$('#commentDiv').append(ret.responseText);
				stato = "OK";
				//alert ("sato refresh commenti:" + stato );
			}
		}
	});
   
	return stato;
}
 
					  
					  

function loadVideoComments()
{
	
	var strUrl = "contents/videoComments/listComm_"+ getVideoId() + ".html" ;
	//alert ("video" + strUrl );
	var statoH = InserisciHtml(strUrl);
	
	if (statoH  != "OK")
	{
		var defText = "<div class=\"js_Scroll-pane_01\"></div>" +
		"<script type=\"text/javascript\">" +
		"	$(function() {" +
		"		$('.js_Scroll-pane_01').jScrollPane(" +
		"			{" +
		"				showArrows: true," +
		"				horizontalGutter: 30," +
		"				verticalGutter: 30" +
		"			}" +
		"		);" +
		"	});" +
		"</script>";
		
		$('#commentDiv').empty();
		$('#commentDiv').append(defText);
	}
}
					
