//TODO:
//input for target region
//events
//nicer chapter,comment,infourl
//new graph parameterformat (old format is in place now)
//refresh
//resize
//getCurrentInteraction

//events
//onvote("vote",value)
//onemail("email",msg,viewername,viewermail)
//onchat("chat",msg,viewername)
//oncomment("comment",msg,viewername)
//onchapter("chapter",newtime)

//BEGIN CLASS Interaction
//public
var _editor_url = "";   
var win_ie_ver=0;
function Interaction(q_OnClickInteraction){
if(Interaction_ok(q_OnClickInteraction)){
	//Public Methods
	this.paint=Interaction_paint;
	this.init=Interaction_init;
	this.resize=Interaction_resize;
	this.OnClickInteraction=q_OnClickInteraction;
	this.getCommand=Interaction_getCommand;
	this.isEditing=Interaction_isEditing;
	this.getChaptertext=Interaction_getChaptertext;
	this.setChapterlist=Interaction_setChapterlist;
	win_ie_ver=(IE() && WIN())?parseFloat(navigator.appVersion.split("MSIE")[1]):0;
	this.myEditconfig=Interaction_EditConfig();
}//end if
}//end function
function Interaction_ok(q_OnClickInteraction){
if((q_OnClickInteraction)){
	return true;
}else{
	alert("Interaction error: All event functions must be defined.");
	return false;
}//end if
}//end function

//public
function Interaction_init(q_producer_id,q_foldername,q_evlist,q_ename,q_edesc,q_econt,q_email,q_vname,q_vmail,q_vbaseurl,q_chapterarrow,q_imgbase,q_chatserver){
if(Interaction_init_ok(q_evlist,q_ename,q_edesc,q_econt,q_email,q_vname,q_vmail,q_vbaseurl,q_chapterarrow,q_imgbase)){
	this.myPRODUCER_ID=q_producer_id;
	this.myFOLDERNAME=q_foldername;
	this.myEventlist=q_evlist;
	this.myEVENTNAME=q_ename;
	this.myEVENTDESCRIPTION=q_edesc;
	this.myEVENTCONTACT=q_econt;
	this.myEVENTMAIL=q_email;
	this.myVIEWERNAME=q_vname;
	this.myVIEWEREMAIL=q_vmail;
	this.myBASEURL=q_vbaseurl;
	this.myChapterarrow=q_chapterarrow;
	this.myImgbase=q_imgbase;
	this.myCHATSERVER=q_chatserver;
	this.myIsEditing=false;
	this.myQuestion="";
}//end if
}//end function

function Interaction_EditConfig(){
var config = new Object();    // create new config object
config.width = "100%";
//config.height = "216px";
config.bodyStyle = 'background-color: white; font-family: "Verdana"; font-size: x-small;';
config.debug = 0;
config.toolbar=[['fontname'],['fontsize'],['Createlink','InsertImage','popupeditor'],    ['linebreak'],['bold','italic','underline','forecolor','separator'],    ['justifyleft','justifycenter','justifyright','separator'],    ['UnOrderedList','Outdent','Indent','separator'],];
return config;
}//end function

function Interaction_init_ok(q_evlist,q_ename,q_edesc,q_econt,q_email,q_vname,q_vmail,q_vbaseurl,q_chapterarrow,q_imgbase){
return true;
}//end function

//public
function Interaction_paint(q_obj,q_inter,q_intertext,q_title,q_layout){
//initializes the Interaction graphics
//matches with _html function

if(Interaction_paint_ok(q_obj,q_inter,q_intertext,q_title,q_layout)){
	//create the object in the target region
//	q_obj.onclick=Interaction_OnClick;
	q_obj.mainobject=this;
	//Private object pointers
	this.myContainer=q_obj;
	this.myInterwidth=parseInt(q_obj.style.width);//277;
	this.myInterheight=parseInt(q_obj.style.height);//270;
	this.myCurInter=q_inter.toLowerCase().replace(" ","").replace("/","");
	this.myLayout=q_layout;
	q_style="font-family:Arial; font-size: 11px;";
	q_style="";//use external CSS	
	var graphicshtml=q_interaction_html(q_obj,this.myCurInter,q_intertext,q_title,q_layout,q_style,this.myImgbase);
	q_obj.innerHTML=graphicshtml;	
	if((q_inter.toLowerCase()=="infohtml") && (q_layout==-1)){
		if(WIN()&&IE())editor_generate("textparameter",this.myEditconfig);
	}//end if
	var q_objectname=q_obj.id;
	this.myTable=div("intertable");
	q_myselect=div("chapterselect");
	if(q_myselect){
	q_myselect.onselect=buttonChapter_Click;
	q_myselect.myImgbase=this.myImgbase;
	checkscrollbar();
	}//end if
	return "";
}//end if
}//end function

function checkscrollbar(){
	if(div("chapterselect_div").offsetHeight-div("chapterselect").offsetHeight>0){
		div("chapterselect_div").style.overflowY="hidden";//hide vertical scrollbar when not needed
	}else{
		var q_obj=div("inter").mainobject;
		myselectScrollto(q_obj.myChapterIndex+1);
	}//end if
}//end function

function Interaction_paint_ok(q_obj,q_inter,q_intertext,q_title,q_layout){
//initializes the Interaction graphics
//matches with _html function
if(q_obj){
}else{
	alert("Interaction_paint error: Destination layer must be present before initializing.");
	return false;
}//end if
if(q_inter.length==0){
	alert("Interaction_paint error: Interaction content needs to be defined.");
	return false;
}//end if
return true;
}//end function

function Interaction_setEditing(state){
try{
	if(gInteraction){
		gInteraction.myIsEditing=state;
	}//end function
}catch(errObj){
}//end catch
}//end function

function Interaction_isEditing(){
return this.myIsEditing;
}//end function

function Interaction_Click(event,q_obj,q_text){
if(event){
event.cancelBubble=true;
}//end if
//alert("Interaction_Click:" + q_obj.parentNode.parentNode.name);
q_Interaction=q_obj.parentNode.parentNode.mainobject;
Interaction_Hide();
q_Interaction.OnClickInteraction(q_text);
}//end function

function Interaction_resize(q_scale){
return q_resizeinter(this,q_scale);
}//end function

function q_resizeinter(q_me,q_scale){
if(("inter7#votepercent#resultgraph#percentgraph").indexOf(q_me.myCurInter)>-1){
//eval(q_lastinteraction);//redraw graph - requires that the drawing command has been stored somewhere
}//end if
q_Obj=document.getElementById("helpframe");
if(q_Obj){
q_Objb=document.getElementById("intertable");
q_Obj.style.width=q_Objb.style.width;
q_Obj.style.height=parseInt(q_Objb.style.height);
}//end if
q_Obj=document.getElementById("Activetop");
if(q_Obj){
q_topheight=q_scale*33;
q_Obj.style.width=q_scale*46;
q_Obj.style.height=q_topheight;
}else{
q_topheight=0;
}//end if
q_Obj=document.getElementById("Activetoprow");
if(q_Obj){
q_Obj.style.height=q_scale*33;
}//end if
var q_iheight=q_me.myInterheight;
q_Obj=document.getElementById("chapterselect_div");//chapter combo
if(q_Obj){
q_Obj.style.height=q_scale*q_iheight-q_topheight;
//document.getElementById("jval").value=(q_scale*q_iheight-q_topheight);
}//end if
try{
	q_fontsize=i_label_fontsize;
}catch(errObj){
	q_fontsize=11;
}//end catch
q_setfontsize(q_scale,q_scale * 17.2,"Activetext");
q_fSize = q_scale*q_fontsize;
q_setfontsize(q_scale,q_fSize,"intertext","mamelabel","mame","emaillabel","email","messagelabel","message","emailsubmit");
q_setfontsize(q_scale,q_fSize,"voteyes","voteno","buttonVoteyes","buttonVoteno");
q_setfontsize(q_scale,q_fSize,"votelabel1","votelabel2","votelabel3","votelabel4","votelabel5","votelabel6");
q_setfontsize(q_scale,q_fSize,"chapterselect");
//q_setfontsize(q_scale,q_fSize,"chatmessage","chat","chatsubmit","chapter");
q_obj=divArray("buttonVote");
if(q_obj){
for (var q_i=0;q_i<q_obj.length;q_i++){
   q_obj[q_i].style.width=q_scale * 20;
   q_obj[q_i].style.height=q_scale * 20;
}//next
}//end if
q_ratio=q_me.myInterheight/q_me.myInterwidth;
q_iwidth=q_me.myInterwidth;
if(q_ratio<0.4){
	q_setwidth("message",0.65*q_iwidth);
	q_setwidth("mame",0.5*q_iwidth);
	q_setwidth("email",0.5*q_iwidth);
	q_setwidth("chatmessage",0.65*q_iwidth);
	q_setwidth("chat",0.65*q_iwidth);
	q_setwidth("chapter",0.65*q_iwidth);
}else if(q_ratio<1.2 && q_me.myInterwidth>210){
	q_setwidth("message",1*q_iwidth);
	q_setwidth("mame",0.7*q_iwidth);
	q_setwidth("email",0.7*q_iwidth);
	q_setwidth("chatmessage",1*q_iwidth);
	q_setwidth("chat",1*q_iwidth);
	q_setwidth("chapter",1*q_iwidth);
}else{
	q_setwidth("message",1*q_iwidth);
	q_setwidth("mame",1*q_iwidth);
	q_setwidth("email",1*q_iwidth);
	q_setwidth("chatmessage",1*q_iwidth);
	q_setwidth("chat",1*q_iwidth);
	q_setwidth("chapter",1*q_iwidth);
}//end if
}//end function

function q_setwidth(q_name,q_width){
if(document.getElementById(q_name)){
	document.getElementById(q_name).style.width=q_width;
}//end if
}//end function

function q_setfontsize(q_scale,q_fSize,q_obj){
for (q_i=2;q_i<q_setfontsize.arguments.length;q_i++){
var q_obj=document.getElementById(q_setfontsize.arguments[q_i]);
if(q_obj){
	var q_size=getPropertyValueFromCss(q_obj.className,"fontSize"); 
	if(q_size){//use css class size
		q_obj.style.fontSize=q_scale*parseInt(q_size);
	}else{//use default size
		q_obj.style.fontSize=q_fSize;
		if(q_fSize<9){
			q_obj.style.fontFamily="Verdana";
		}//end if
   }//end if
}//end if
}//next
}//end function

function Interaction_getCommand(q_f){
if(this.myLayout=-1){
	return q_interaction_makecmd(this.myCurInter,q_f);
}else{
	return "";
}//end if
}//end function

function Interaction_updateId(q_inter){
switch(q_inter){
case "inter1":return "Email";
case "inter2":return "Poll Multiple";
case "inter3":return "Poll Yes/No";
case "inter4":return "ResultText";
case "inter5":return "InfoPicture";
case "inter6":return "Infotext";
case "inter7":return "ResultGraph";
case "inter8":return "Chat";
case "inter9":return "Chapter";
case "inter10":return "Comment";
case "inter11":return "InfoURL";
case "votepercent":return "PercentGraph";
case "animate":return "Animate Slide";
case "advertisement":return "Advertisement";
case "addcomment":return "Add Comment";
default:return q_inter;
}//end select
}//end function

function Interaction_getChaptertext(){
var q_chaptercmd=this.myEventlist[this.myChapter][1];
var q_chapterparameters=splitAction(q_chaptercmd);
if(q_chapterparameters.length>4){
	return q_chapterparameters[2];
}else{
	return "";
}//end if
}//end function

function Interaction_setChapterlist(q_ev){
this.myEventlist=q_ev;
}//end function

function q_interaction_makecmd(q_inter,q_f){
if(q_f.textparameter){
	if(q_inter.toLowerCase()=="infohtml"){
		var q_astr=escape(q_f.textparameter.value);
	}else{
		var q_astr=q_f.textparameter.value;
	//	q_astr=scandChar(cleanquotes(q_astr));
		q_astr=jssyntax(q_astr);
		q_astr=smartendspace(q_astr,q_inter);
	}//end if
}//end if
if(q_f.inputtitle){
	var q_title=q_f.inputtitle.value;
//	q_title=scandChar(cleanstring(q_title));
	q_title=jssyntax(q_title);
	q_title=smartendspace(q_title,q_inter);
}//end if
switch (q_inter){
case "slide":
	var dummyCurSlidecount="20";
   return "setdoc('"+replace(q_astr,"<br>"," ")+"',"+dummyCurSlidecount+",1);";
case "animateslide":   
   return "setinter('"+q_inter+"','','',1);";
case "webpage":
   return q_validhttp(q_astr,"setdoc('"+q_astr+"',1,1);");
case "openurl":
   return q_validhttp(q_astr,"setinter('"+q_inter+"','"+q_astr+"','Webwindow',0);");
case "database":
   q_bstr="<%=SQLASPURL%>";
   q_bstr=q_bstr + "odbc=" + q_f.odbc.value + "&";
   q_bstr=q_bstr + "user=" + q_f.user.value + "&";
   q_bstr=q_bstr + "pwd=" + q_f.pwd.value + "&";
   q_bstr=q_bstr + "sql=" + q_f.sql.value;
//   q_bstr=replace(q_bstr,"'","zz39");
//   q_bstr=replace(q_bstr,'"','#');
//   q_bstr=replace(q_bstr,'#','\\\"');
   return "setslide('"+replace(q_bstr,"<br>"," ")+"',1);";
case "chapter":
   return "setinter('"+q_inter+"','"+q_astr+"','"+q_title+"',2);";
case "infotext":
   return "setinter('"+q_inter+"','"+q_astr+"','"+q_title+"',2);";
case "infourl":
   return "setinter('"+q_inter+"','"+q_astr+"','"+q_title+"',2);";
case "infopicture":
   q_astr=replace(q_astr,"\\","/");
   return "setinter('"+q_inter+"','"+replace(q_astr,"<br>"," ")+"','"+q_title+"',2);";
case "advertisement":
   return "setinter('"+q_inter+"','"+replace(q_astr,"<br>"," ")+"','',3);";
case "comment":
   return "setinter('"+q_inter+"','"+replace(q_astr,"<br>"," ")+"','"+q_title+"',0);";
case "sync":
   return "setinter('"+q_inter+"','1','"+q_title+"',0);";
case "flip":
   return "setinter('"+q_inter+"','1','"+q_title+"',0);";
case "goto":
   return "setinter('"+q_inter+"','"+q_astr+"','"+q_title+"',0);";
case "fullscreen":
   return "setinter('"+q_inter+"','"+q_astr+"','"+q_title+"',0);";
case "script":
   return "setinter('"+q_inter+"','"+replace(q_astr,"<br>"," ")+"','"+q_title+"',0);";
case "infohtml":
   return "setinter('"+q_inter+"','"+q_astr+"','',2);";
case "notes":
   return "setinter('"+q_inter+"','','"+q_title+"',3);";
case "flash":
   return q_validhttp(q_astr,"setdoc('"+q_astr+"',1,1);");
case "excel":
   return q_validhttp(q_astr,"setdoc('"+q_astr+"',1,1);");
case "word":
   return q_validhttp(q_astr,"setdoc('"+q_astr+"',1,1);");
case "pdf":
   return q_validhttp(q_astr,"setdoc('"+q_astr+"',1,1);");
case "image":
   return q_validhttp(q_astr,"setdoc('"+q_astr+"',1,1);");
case "email":
   return "setinter('"+q_inter+"','"+q_astr+"','"+q_title+"',2);";
case "chat":
   return "setinter('"+q_inter+"','','"+q_title+"',2);";
case "pollyesno":
   return "setinter('"+q_inter+"','"+q_astr+"(yes,no)','"+q_title+"',2);";
case "pollmultiple":
   q_sep="";
   q_opt="";
   for (ix=0;ix<6;ix++){
	   if(document.form1.LABEL[ix].value==""){
	   }else{
		   q_opt=q_opt+ q_sep + q_f.LABEL[ix].value;
		   q_sep=",";
	   }//end if
   }//next
   if(q_opt!==""){
//	   q_astr=q_cleanarg(q_f.textparameter3.value)+" ("+q_cleanarg(q_opt) + ")";
	   q_astr=jssyntax(q_f.textparameter3.value)+" ("+jssyntax(q_opt) + ")";
		
   }else{
//	   q_astr=q_cleanarg(q_f.textparameter3.value);
	   q_astr=jssyntax(q_f.textparameter3.value);
   }//end if
   var q_goto=document.getElementById("GOTO");
   if(q_goto){
	q_astr=q_astr+"GOTO("+q_goto.value+")";
   }//end if
   return "setinter('"+q_inter+"','"+q_astr+"','"+q_title+"',2);";
case "resulttext":
   return "setinter('"+q_inter+"','','"+q_title+"',2);";
case "resultgraph":
   return "setinter('"+q_inter+"','','"+q_title+"',2);";
case "percentgraph":
   return "setinter('"+q_inter+"','','"+q_title+"',2);";
default : 
   return "";
}//switch
}//end function

function q_validhttp(q_str,q_cmd){
if((q_str.substr(0,7)=="http://") || (q_str.substr(0,8)=="https://")){
	return replace(q_cmd,"\n","");
}else if((q_str.substr(0,10)=="documents/")){
	return replace(q_cmd,"\n","");
}else{
	alert("URL ("+q_str+") must start with http://");
 return "";
}//end if
}//end function


function q_interaction_html(q_obj,q_inter,q_intertext,q_title,q_layout,q_style,q_imgbase){
var q_head;
if(q_title==""){
	q_head=q_inter;
}else if(q_title.indexOf("voteresultchart")>-1){
	q_head="Result";
}else{
	q_head=q_title;
}//end if
if(q_layout==-1){
	q_headingheight=33;
	q_content=q_iinput_html(q_obj.mainobject,q_inter,q_intertext,q_title,q_layout,q_obj.mainobject.myInterwidth,q_obj.mainobject.myInterheight-q_headingheight);
	q_head="<input id='inputtitle' type='text' style='width:100%; font-family:Verdana; font-size:18px; font-style:italic; background-color:#d0d0d0;' value='"+q_head+"'>";
}else if(q_layout==0){
	q_headingheight=0;
	q_content=q_icontent_html(q_obj.mainobject,q_inter,q_intertext,q_title,q_layout,q_obj.mainobject.myInterwidth,q_obj.mainobject.myInterheight-q_headingheight,q_headingheight,q_imgbase);
}else{
	q_headingheight=33;
	q_content=q_icontent_html(q_obj.mainobject,q_inter,q_intertext,q_title,q_layout,q_obj.mainobject.myInterwidth,q_obj.mainobject.myInterheight-q_headingheight,q_headingheight,q_imgbase);
}//end if

if(q_content==""){
	html="";
}else if(q_layout==0 || q_inter.toLowerCase()=="infohtml"){
	html=intertablesimple_html(q_style,q_content,q_intertext);
}else{
	html=intertable_html(q_inter,q_style,q_headingheight,q_imgbase,q_head,q_content,q_intertext);
}//end if
return html;
}//end function

function intertablesimple_html(q_style,q_content,q_intertext){
var html="<table id='intertable' name='intertable' style='"+q_style+" width:100%; height:100%;' border='0' cellPadding='0' cellSpacing='0'>"+q_content+"</table>";
q_intertext=q_intertext.replace("GOTO()","");
html=html.replace("z_intertext",q_intertext);
return html;
}//end function

function intertable_html(q_inter,q_style,q_headingheight,q_imgbase,q_head,q_content,q_intertext){
var q_imagename=q_inter.toLowerCase().replace(" ","").replace("/","");
var html="<table id='intertable' name='intertable' style='"+q_style+" width:100%; height:100%;' border='0' cellPadding='0' cellSpacing='0'>"+
"<tr id='Activetoprow' style='height:"+q_headingheight+"px; background-image:url("+q_imgbase+"active_top.gif);'>"+
"<td colspan='1' width=46 align='left'>"+
"<img id='Activetop' src='"+q_imgbase+"active_"+q_imagename+".gif' width=46 height=33><br>"+
"</td>"+
"<td colspan='2' align='left' id='Activetext' class='i_title' style='width:80%;'>"+
q_head+
"</td>"+
"</tr>"+
q_content+
"</table>";
html=html.replace("z_intertext",q_intertext);
return html;
}//end function

function q_icontent_html(q_obj,q_inter,q_intertext,q_title,q_layout,q_width,q_height,q_top,q_imgbase){
switch (q_inter){
case "slide":return q_ihtml(q_obj);
case "animateslide":return q_ihtml(q_obj);
case "webpage":return q_ihtml(q_obj);
case "openurl":return q_ihtml(q_obj);
case "database":return q_ihtml(q_obj);
case "chapter":return q_ichapter_html(q_obj,q_intertext,q_height,q_imgbase);
case "infotext":return q_iinfotext_html(q_obj);
case "infourl":return q_iinfourl_html(q_obj,q_intertext,q_width,q_height);
case "infopicture":return iinfopicture_html(q_obj,q_intertext,q_width,q_height,q_top);
case "advertisement":return q_ihtml(q_obj);
case "inputcomment":return icomment_html(q_obj,q_imgbase);
case "infohtml":return q_iinfohtml_html(q_obj,q_intertext);
case "notes":return inotes_html(q_obj);
case "flash":return q_ihtml(q_obj);
case "excel":return q_ihtml(q_obj);
case "word":return q_ihtml(q_obj);
case "pdf":return q_ihtml(q_obj);
case "image":return q_ihtml(q_obj);
case "email":return iemail_html(q_obj,q_intertext,q_layout);
case "chat":var q_chatroom=q_obj.myCHATSERVER+"a_chat.asp?CHATROOM="+q_obj.myFOLDERNAME+"&fromsender="+q_obj.myVIEWERNAME;
return q_iinfourl_html(q_obj,q_chatroom,q_width,q_height);//return ichat_html(q_obj);
case "pollyesno":return ipollyesno_html(q_obj,q_intertext);
case "pollmultiple":return ipollmultiple_html(q_obj,q_intertext);
case "resulttext":return replace(q_iinfotext_html(q_obj),"z_intertext",replace(removeGotoOptions(q_intertext),",",", "));
case "resultgraph":return iresultgraph_html(q_obj,q_intertext,q_title,1);
case "percentgraph":return iresultgraph_html(q_obj,q_intertext,q_title,0);
default : return "";
}//switch
}//end function

function q_iinput_html(q_obj,q_inter,q_intertext,q_title,q_layout,q_width,q_height){
switch (q_inter){
case "slide":return ipar17_html(q_obj,q_intertext,"Advance slide in the slide region.");
case "animateslide":return ipar15_html(q_obj,"","Advance slide animation.");
case "webpage":return ipar17_html(q_obj,q_intertext,"Show a web page in the slide region. Please enter URL to the web page:");
case "openurl":return ipar17_html(q_obj,q_intertext,"A webpage will be opened in a separate window. Please enter URL:");
case "database":return ipar16_html(q_obj,q_intertext,"Fetch and display a query result from a database. Please enter connection parameters and SQL query:");
case "chapter":return ipar17_html(q_obj,q_intertext,"Mark index point for a chapter. Please edit title for the chapter.");
case "infotext":return ipar17_html(q_obj,q_intertext,"Show information text in the interaction region. Please edit text:");
case "infourl":return ipar17_html(q_obj,q_intertext,"Show customized webpage in the interaction region. Please enter the URL pointing to your webfile:");
case "infopicture":return ipar17_html(q_obj,q_intertext,"Put a picture in the interaction region. Please enter URL or browse for the picture:");
case "advertisement":return ipar17_html(q_obj,q_intertext,"Create a looping advertisement/banner sequence. Please enter a list of URLs and text separated with commas:");
case "comment":return ipar17_html(q_obj,q_intertext,"Show comments as a rolling text in the top part of the window. Please enter a comment to send.");
case "sync":return ipar15_html(q_obj,q_intertext,"Syncronize a secondary video playing in the slide region.");
case "flip":return ipar15_html(q_obj,q_intertext,"Flip video and slide region.");
case "script":return ipar17_html(q_obj,q_intertext,"This command will execute a javascript. Enter your javascript below.");
case "goto":return ipar17_html(q_obj,q_intertext,"Jump to another position in the videotrack. Enter a chapter title or enter the absolute time in the format 00:00:00");
case "fullscreen":return ipar17_html(q_obj,q_intertext,"Change video into fullscreen mode. Enter value below 1=fullscreen or 0=normal.");
case "notes":return ipar15_html(q_obj,"","Show slide notes in the interaction region.");
case "infohtml":return ipar19_html(q_obj,q_intertext,"Show custom HTML in the interaction region. Please edit  your HTML content below:");
case "flash":return ipar17_html(q_obj,q_intertext,"Show Flash presentation in slide region. Please enter URL or browse to the Flash file:");
case "excel":return ipar17_html(q_obj,q_intertext,"Show Excel document in slide region. Please enter URL or browse to the Excel file:");
case "word":return ipar17_html(q_obj,q_intertext,"Show Word document in slide region. Please enter URL or browse to the Word file:");
case "pdf":return ipar17_html(q_obj,q_intertext,"Show Acrobat PDF document in slide region. Please enter URL or browse to the PDF file:");
case "image":return ipar17_html(q_obj,q_intertext,"Show a picture file (gif/jpg) in the slide region. Please enter URL or browse for the picture:");
case "email":return ipar17_html(q_obj,q_intertext,"Open an email window in the viewer interaction window.");
case "chat":return ipar15_html(q_obj,"","Open a chat window.");
case "pollyesno":return ipar17_html(q_obj,q_intertext,"Ask audience to vote yes or no. Please enter your voting question:");
case "pollmultiple":return ipar18_html(q_obj,q_intertext,"Ask multiple choice question. Please enter voting question and answer options:");
case "resulttext":return ipar15_html(q_obj,q_intertext,"Show last voting result as text.");
case "resultgraph":return ipar15_html(q_obj,q_intertext,"Show voting result as a graph. Press send to show the result.");
case "percentgraph":return ipar15_html(q_obj,q_intertext,"Show voting result as a graph with percentage indication. Press send to show the result.");
default : return "";
}//switch
}//end function

function q_ihtml(q_obj){
return "<tr> "+
"<td colspan='3' style='padding-left:5px; padding-right:5px;'>"+
"</td>"+
"</tr>";
}//end function

function q_ichapter_html(q_obj,q_arg,q_height,q_imgbase){
var q_list=q_getChapterIndexlist(q_obj.myEventlist);
//q_style="font-family:Verdana; font-size:10px;";
q_style="i_input";
q_obj.myChapterIndex=q_optionindex(q_obj.myEventlist,q_list,q_arg);
q_obj.myChapter=q_list[q_obj.myChapterIndex];
var q_scroll=(q_obj.myChapterarrow=="0");
return "<tr> "+
"<td colspan='3' style='padding-left:0px; padding-right:0px;'>"+
makeIndexSelect_html(q_obj,q_list,q_obj.myChapterIndex,"chapterselect",q_style,q_height,q_obj.myChapterarrow,q_imgbase,q_scroll)+
"</td>"+
"</tr>"+
"<tr><td>&nbsp;</td></tr>";
}//end function

function q_isChapter(q_eventlist,q_i){
if(q_eventlist[q_i][1]){
	var q_str=WildFind(0,q_eventlist[q_i][1],"setinter('chapter','*'");
   if(q_str>"" && q_str!=" "){
		return true;
	}else{
		return false;
	}//end if
}else{
	return false;
}//end if
}//end function

function q_getChapterText(q_eventlist,q_i){
	return WildFind(0,q_eventlist[q_i][1],"setinter('chapter','*'");
}//end function

function q_getChapterIndexlist(q_eventlist){
var q_cl=new Array();
if(q_eventlist){ 
	for (var q_i=0;q_i<q_eventlist.length;q_i++){
		if(q_isChapter(q_eventlist,q_i)){
			q_cl[q_cl.length]=q_i;
		}//end if
	}//next
	return q_cl;
}else{
	return null;
}//end if
}//end function

function isInArray(thearray,q_str){
for(var q_i=0;q_i<thearray.length;q_i++){
	if(thearray[q_i].indexOf(q_str)>-1){
		return true;
	}//end if
}//next
return false;
}//end function

function arg2eventlistindex(q_value){
var q_ev=q_Interaction.myEventlist;
for (var q_i=0;q_i<q_ev.length;q_i++){
		if(startswith(q_ev[q_i][1],"setinter('chapter','"+q_value+"'")){
		return q_i;
		}//end if
}//next
return -1;
}//end function

function q_optionindex(q_ev,q_index,q_value){
if(isNumeric(q_value)){
	for (var q_i=0;q_i<q_index.length;q_i++){
			if(q_index[q_i]==q_value){
				return q_i;
			}//end if
	}//next
}else{
	for (var q_i=0;q_i<q_index.length;q_i++){
			var q_text=q_getChapterText(q_ev,q_index[q_i]);
			if(startswith(q_text,q_value)){
			return q_i;
			}//end if
	}//next
}//end if
return -1;
}//end function

function getSelectWrapper_html(q_name,q_style,q_height,q_scroll){
var q_t1,q_t2;
if(q_scroll){
	q_t1="<div id='"+q_name+"_div' style='height:"+q_height+"px; overflow:scroll; overflow-x:hidden; overflow-y:scroll;'>\n";
}else{
	q_t1="<div id='"+q_name+"_div' style='height:"+q_height+"px; overflow:scroll; overflow-x:hidden; overflow-y:hidden;'>\n";
}//end if
if(q_style=="i_input"){
	q_t2="<table id='"+q_name+"' class='"+q_style+"' style='width:100%; border-collapse:collapse; border-style:none;'>\n";
}else{
	q_t2="<table id='"+q_name+"' style='"+q_style+" border-collapse:collapse; border-style:none;'>\n";
}//end if
return q_t1+q_t2+"z_ROWS</table></div>";
}//end function

function makeIndexSelect_html(q_obj,q_G,q_selected,q_name,q_style,q_height,q_c3,q_imgbase,q_scroll){
var q_clickproc;
var q_class="";
var q_iscolorstyle=(q_c3=="0");
if(q_iscolorstyle){
	q_clickproc="myselect_color";
}else{
	q_clickproc="myselect_click";
}//end if
var q_html=new Array();

for (var q_row=0;q_row<q_G.length;q_row++){
	if((q_row==q_selected)&&(q_iscolorstyle)){
		q_class="col_3";
	}else if(q_row%2==0){
		q_class="col_1";
	}else{
		q_class="col_2";
	}//end if
	var q_time=q_obj.myEventlist[q_G[q_row]][0];
	var q_text=q_getChapterText(q_obj.myEventlist,q_G[q_row]);
	q_html[q_html.length]="<tr class='"+q_class+"' onclick='"+q_clickproc+"(event,this,"+q_row+","+q_time+")'>"; 
	if((q_row==q_selected)&&(!q_iscolorstyle)){
		q_html[q_html.length]="<td><img src='"+q_imgbase+"cuelist_rowmark.gif'></td>"; 
	}else{
		q_html[q_html.length]="<td width=5>&nbsp;</td>"; 
	}//end if
	q_html[q_html.length]="<td valign='top' class='"+q_class+"'>"+q_text+"</td>"; 
	q_html[q_html.length]="</tr>\n"; 
}//next

var q_str=getSelectWrapper_html(q_name,q_style,q_height,q_scroll);
q_str=q_str.replace("z_ROWS",q_html.join(""));
return q_str;
}//end function

function myselectScrollto(q_row){
var q_obj=document.getElementById("chapterselect_div");
var q_table=document.getElementById("chapterselect");
scrollBottomto(q_obj,getRowtop(q_table,q_row));
}//end function

function myselect_click(q_ev,q_obj,q_selrow,q_time){
var q_table=q_obj.parentNode.parentNode;
var q_imgbase="";
if (q_table.myImgbase){
	 q_imgbase=q_table.myImgbase;
}//end if
var q_value=-1;
//q_table=document.getElementById("myselect");
for (var q_row=0;q_row<q_table.rows.length;q_row++){
 	if(q_row==q_selrow){
		setTablecell(q_table,q_row,0,"<img src='"+q_imgbase+"cuelist_rowmark.gif'>");
		q_value=q_row;
	}else{
		setTablecell(q_table,q_row,0,"&nbsp;");
	}//end if
}//next
if(q_table.onselect){
q_table.onselect(q_table,q_selrow,q_value,q_time);
}//end if
}//end function

function myselect_color(q_ev,q_obj,q_selrow,q_time){
var q_table=q_obj.parentNode.parentNode;
var q_value=-1;
//q_table=document.getElementById("myselect");
for (var q_row=0;q_row<q_table.rows.length;q_row++){
 	if(q_row==q_selrow){
//		setTablerowcolor(q_table,q_row,q_C3);
		setTablerowclass(q_table,q_row,"col_3");
		q_value=q_row;
	}else if(q_row%2==0){
//		setTablerowcolor(q_table,q_row,q_C1);
		setTablerowclass(q_table,q_row,"col_1");
	}else{
//		setTablerowcolor(q_table,q_row,q_C2);
		setTablerowclass(q_table,q_row,"col_2");
	}//end if
}//next
if(q_table.onselect){
	q_table.onselect(q_table,q_selrow,q_value,q_time);
}//end if
}//end function

function buttonChapter_Click(q_table,q_row,q_value,q_time){
var q_Interaction=q_table.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.mainobject;
if(q_time>-1){
	q_Interaction.OnClickInteraction("chapter",q_Interaction.myVIEWERNAME,q_time,q_value);
}else{
	alert("Chapter error:"+HTMLEncode(q_value));
}//end if
}//end function

function q_iinfotext_html(q_obj){
return "<tr> "+
"<td id='intertext' name='intertext' colspan='3' style='padding-left:5px; padding-right:5px;' class='i_label'>z_intertext</td>"+
"</tr>"+
"<tr> "+
"<td colspan='3' style='padding-left:5px; padding-right:5px;' class='i_label'>"+
"&nbsp;"+
"</td>"+
"</tr>";
}//end function

function q_iinfohtml_html(q_obj,q_intertext){
return "<tr> "+
"<td id='intertext' name='intertext' colspan='3' style='width:100%; height:100%;'>"+unescape(q_intertext)+"</td></tr>";
}//end function

function q_iinfourl_html(q_obj,q_intertext,q_width,q_height){
if(q_intertext==""){
return "<tr>"+
"<td id='intertext' name='intertext' colspan='3' style='padding-left:5px; padding-right:5px;'  class='i_label'>"+
q_obj.myEVENTNAME+"<br>"+
q_obj.myEVENTDESCRIPTION+"<br><br>"+
"Contact:<a href='mailto:"+q_obj.myEVENTMAIL+"'>"+q_obj.myEVENTCONTACT+"</a><br><br>"+
"</td>"+
"</tr>"+
"<tr><td>&nbsp;</td></tr>";
}else{
return "<tr>"+
"<td id='intertext' name='intertext' colspan='3' class='i_label'>"+
q_gethelpcontent(q_intertext,q_width,q_height,q_obj.mySCROLLBARS,q_obj.myBASEURL)+
"</td>"+
"</tr>";//+"<tr><td>&nbsp;</td></tr>"
}//end if
}//end function

function q_gethelpcontent(q_txt,q_width,q_height,q_USESCROLLBARS,q_BASEURL){
if(startswith(q_txt,"documents/")){
	q_txt=q_BASEURL+q_txt;
}//end if
if(startswith(q_txt,"http://")||startswith(q_txt,"documents/")){
	q_ext=fileextension(q_txt);
	if((q_ext=="gif")||(q_ext=="jpg")){
		return "<img style='width:100%; height:100%;' src='"+q_txt+"'>";
	}else{
		return "<iframe id='helpframe' name='helpframe' frameborder='0' style='width:" + q_width + "; height:" + q_height + ";' src='" + q_txt + "' scrolling='"+q_USESCROLLBARS+"' onload='q_adsframe_load();'></iframe>";
	}//end if
}else if(q_txt==""){
	return "<div style='width:" + q_width + "; height:" + q_height + ";'>"+q_txt+"</div>";
}else{
	return "<div style='width:100%; height:100%;background-color: #FFFFFF;color:#000000;text-align: center; vertical-align: middle;'>"+q_txt+"</div>";
}//end if
}//end function

function q_adsframe_load(){}//end function

function iinfopicture_html(q_obj,q_intertext,q_width,q_height,q_top){
if(!(q_intertext.substr(0,4)=="http")){
	q_intertext=q_obj.myBASEURL+q_intertext;
}//end if
return "   <tr> "+
"   <td id='intertext' name='intertext' colspan='3' class='i_label'>"+
"	      <div><img id='inter5img' name='inter5img' src='"+q_intertext+"' style='width:"+q_width+"px; left:0; top:"+q_top+"px; clip: rect(0px, "+q_width+"px, "+q_height+"px, 0px); position:absolute;' valign='top'><br></div>"+
"</td>"+
"   </tr>"+
"   <tr style='height:50%;' > "+
"   <td colspan='3' class='i_label'>"+
"	&nbsp;"+
"	</td>"+
"   </tr>";
}//end function

function icomment_html(q_obj,q_imgbase){
return "<tr> "+
"<td colspan='3' style='padding-left:5px; padding-right:5px;' class='i_label'>"+
"<img src='"+q_imgbase+"butagree.gif' title='I agree'onclick='document.getElementById(\"comment\").value=this.title;'>&nbsp;&nbsp;"+
"<img src='"+q_imgbase+"butdisagree.gif' title='I disagree'onclick='document.getElementById(\"comment\").value=this.title;'><br>"+
"<img src='"+q_imgbase+"butbored.gif' title='Get to the point' onclick='document.getElementById(\"comment\").value=this.title;'>&nbsp;&nbsp;"+
"<img src='"+q_imgbase+"butconfused.gif' title='Explain more' onclick='document.getElementById(\"comment\").value=this.title;'><br>"+
"<img src='"+q_imgbase+"butlouder.gif' title='Talk louder' onclick='document.getElementById(\"comment\").value=this.title;'>&nbsp;&nbsp;"+
"<img src='"+q_imgbase+"butslower.gif' title='Talk slower'onclick='document.getElementById(\"comment\").value=this.title;'><br>"+
"<input id='comment' name='comment' class='i_input' style='width:100%;' type='text' value='' onkeypress='if (event.keyCode==13){buttonComment_Click(event,this);event.cancelBubble=true;}'><br>"+
"<input class='i_input' id='buttonComment' name='buttonComment' type='button' value='Send Comment' onclick='buttonComment_Click(event,this);'>"+
"</td>"+
"</tr>"+
"<tr><td>&nbsp;</td></tr>";
}//end function
function buttonComment_Click(event,q_obj){
q_Interaction=q_obj.parentNode.parentNode.parentNode.parentNode.parentNode.mainobject;
q_Interaction.OnClickInteraction("comment",q_Interaction.myVIEWERNAME,"",inp("comment"));
}//end function

function inotes_html(q_obj){
return "<tr> "+
"<td colspan='3' style='padding-left:5px; padding-right:5px;' class='i_label'>"+
"NOTES ARE NOT IMPLEMENTED<br>"+
"</td>"+
"</tr>"+
"<tr><td>&nbsp;</td></tr>";
}//end function

function iemail_html(q_obj,q_intertext,q_layout){
if(q_layout==1){
	var q_head="";
}else{
	var q_head="Email:";
}//end if
return "<tr > "+
"<td colspan='3' style='padding-left:5px; padding-right:5px;' id='messagelabel' name='messagelabel' class='i_label'>"+q_head+"<br>"+
"<textarea id='interMessage' name='interMessage' class='i_input' wrap='physical' style='width:100%;' rows=4>"+q_intertext+"</textarea><br>"+
"</td>"+
"</tr>"+
"<tr> "+
"<td colspan='3' style='padding-left:5px; padding-bottom:5px;' >"+
"<input id='emailsubmit' name='emailsubmit' id='buttonEmail' name='buttonEmail' class='i_button' type='button' value='Submit' onClick='buttonEmail_Click(event,this);'><br>"+
"</td>"+
"</tr>";
}//end function
function buttonEmail_Click(event,q_obj){
q_Interaction=q_obj.parentNode.parentNode.parentNode.parentNode.parentNode.mainobject;
q_Interaction.OnClickInteraction("email",q_Interaction.myVIEWERNAME,q_Interaction.myVIEWEREMAIL,inp("interMessage"));
}//end function

function ichat_html(q_obj){
return "<tr> "+
"<td colspan='3' style='padding-left:5px; padding-right:5px;'>"+
"<textarea class='i_input' wrap='physical' style='width:100%;' rows='9' id='chatmessage' name='chatmessage' onclick='this.form.chat.focus();' onkeypress='if(event.keyCode==13){buttonChat_Click(event,this);event.cancelBubble=true;return false;}'></textarea>"+
"</td>"+
"</tr>"+
"<tr> "+
"<td colspan='3' style='padding-left:5px; padding-right:5px;'>"+
"<input class='i_input' type='text' id='chat' name='chat' style='width:100%;' maxlength='100' onkeypress='if(event.keyCode==13){buttonChat_Click(event,this);event.cancelBubble=true;return false;}'>"+
"</td>"+
"</tr>"+
"<tr> "+
"<td colspan='3' style='padding-left:5px; padding-right:5px;' >"+
"<input id='chatsubmit' name='chatsubmit' class='i_button' type='button' id='submit' name='submit' value='Submit' onClick='buttonChat_Click(event,this);' >"+
"</td>"+
"</tr>"+
"<tr><td>&nbsp;</td></tr>";
}//end function
function buttonChat_Click(event,q_obj){
q_Interaction=q_obj.parentNode.parentNode.parentNode.parentNode.parentNode.mainobject;
q_Interaction.OnClickInteraction("chat",q_Interaction.myVIEWERNAME,"",q_obj.form.chat.value);
if(q_obj.form.chat){
	q_obj.form.chat.value="";
}//end if
}//end function

function ipollyesno_html(q_obj,q_intertext){
var q_votequestion=q_intertext;
var q_goto=WildFind(0,q_votequestion,"GOTO(*)");
var q_votequestion=replace(q_votequestion,"GOTO("+q_goto+")","");
q_obj.myQuestion=q_votequestion;

return "<tr> "+
"<td id='intertext' name='intertext' colspan='3' style='padding-left:5px; padding-right:5px;' class='i_label'>"+q_votequestion+"</td>"+
"</tr>"+
"<tr> "+
"<td>"+
"</td>"+
"<td id='voteyes' name='voteyes' colspan='1' style='padding-left:5px; padding-right:5px;' >"+
"<input type='button' id='buttonVoteyes' name='buttonVoteyes' class='i_button' style='width:50px;' value='Yes' onClick='buttonVote_Click(event,this);'>"+
"</td>"+
"<td id='voteno' name='voteno' colspan='1' style='padding-left:5px; padding-right:5px;' >"+
"<input type='button' id='buttonVoteno' name='buttonVoteno' class='i_button' style='width:50px;' value='No' onClick='buttonVote_Click(event,this);'>"+
"</td>"+
"</tr>"+
"<tr> "+
"<td colspan='3' style='padding-left:5px; padding-right:5px;' class='i_label'>"+
"&nbsp;"+
"</td>"+
"</tr>";
}//end function


function removeGotoOptions(q_votequestion){
var str=q_votequestion;
var q_options=WildFind(0,str,"(*)");
var q_goto=WildFind(0,str,"GOTO(*)");
str=replace(str,"("+q_options+")","");
str=replace(str,"GOTO("+q_goto+")","");
return str;
}//end function

function ipollmultiple_html(q_obj,q_intertext){
var q_votequestion=q_intertext;
if(q_votequestion!=""){
  	var q_goto=WildFind(0,q_votequestion,"GOTO(*)");
	q_votequestion=replace(q_votequestion,"GOTO("+q_goto+")","");
	q_obj.myQuestion=q_votequestion;
  	var q_options=WildFind(0,q_votequestion,"(*)");
	q_votequestion=replace(q_votequestion,"("+q_options+")","");
	q_option=q_options.split(",");
}//end if
q_html="<tr>"+
"<td id='intertext' name='intertext' colspan='3' style='padding-left:5px; padding-right:5px;' class='i_label'>"+q_votequestion+"</td>"+
"</tr>";
for (q_i=1;q_i<=6;q_i++){
var q_opt=q_option[q_i-1];
if(q_opt){
	q_html=q_html + "<tr> ";
	q_html=q_html + "<td id='vote15label" + q_i + "' name='vote15label" + q_i + "' colspan='3' class='i_label' style='padding-left:5px; padding-right:5px;' > ";
	if(endswith(q_opt,"*")){
		q_html=q_html + "<input type='radio' id='buttonVote"+q_i+"' name='buttonVote' value='"+q_i+"' onClick='buttonVote_Click(event,this);'>"+left(q_opt,q_opt.length-1)+ "</td>";
	}else{
		q_html=q_html + "<input type='radio' id='buttonVote"+q_i+"' name='buttonVote' value='"+q_i+"' onClick='buttonVote_Click(event,this);'>"+q_opt+"</td>";
	}//end if
	q_html=q_html + "</tr>";
}else{
}//end if
}//next
return q_html;
}//end function

function buttonVote_Click(event,q_obj){
q_Interaction=q_obj.parentNode.parentNode.parentNode.parentNode.parentNode.mainobject;
q_Interaction.OnClickInteraction("vote",q_Interaction.myVIEWERNAME,"",q_obj.value);
}//end function

function iresultgraph_html(q_obj,q_intertext,q_intergraph,q_type){
if(q_intertext==""){
	q_votequestion="z_intertext";
}else if(q_intertext.indexOf(")(")>-1){
	q_votequestion=q_intertext.substr(0,q_intertext.indexOf("("));
	q_votequestion=q_votequestion+"<br><br>"+q_getRZchart4(q_type,q_obj.myInterwidth,q_obj.myInterheight,q_intertext);
}else{
	q_votequestion=replace(q_intertext,",",", ");//old style - already evaluated
}//end if
q_votequestion=removeGotoOptions(q_votequestion);
return "<tr> "+
"<td id='intertext' name='intertext' colspan='3' style='padding-left:5px; padding-right:5px;' class='i_label'>"+q_votequestion+"</td>"+
"</tr>"+
"<tr> "+
"<td colspan='3' style='padding-left:5px; padding-right:5px;' class='i_label'>"+
"&nbsp;"+
"</td>"+
"</tr>";
}//end function

function ipar15_html(q_obj,q_intertext,q_help){
return "<tr><td id='text15' colspan='3' style='padding-left:5px; padding-right:5px;' class='i_label' >"+q_help+"</td></tr>"+
"<tr><td>&nbsp;</td></tr>";
}//end function

function ipar16_html(q_obj){
return "<tr style='padding-left:5px; padding-right:5px;' class='i_label'><td>ODBC</td><td>User</td><td>Password</td></tr>"+
"<tr style='padding-left:5px; padding-right:5px;'>"+
"<td><input class='i_input' type='text' name='odbc' value='' style='width:40px' maxlength='50'></td>"+
"<td><input class='i_input' type='text' name='user' value='' style='width:80px' maxlength='50'></td>"+
"<td><input class='i_input' type='password' name='pwd' value='' style='width:80px' maxlength='50'></td>"+
"</tr>"+
"<tr><td valign='left' colspan='3' style='padding-left:5px; padding-right:5px;' class='i_label'>Select Query<br>"+
"<textarea class='i_input' name='sql' rows='6' style='width:100%;'></textarea></td>"+
"</tr>";
}//end function

function ipar17_html(q_obj,q_intertext,q_help){
return "<tr><td id='text17' colspan='3' style='padding-left:5px; padding-right:5px;' class='i_label'>"+q_help+"</td></tr>"+
"<tr><td colspan='3' style='padding-left:5px; padding-right:5px;'>"+
"<textarea id='textparameter' name='textparameter' class='i_input' rows='6' style='width:100%;' onfocus='Interaction_setEditing(true)' onblur='Interaction_setEditing(false)'>"+
q_intertext+"</textarea><br>"+
"</td></tr>";
}//end function

function ipar18_html(q_obj,q_intertext,q_help){
if(q_intertext!=""){
   q_options=WildFind(0,q_intertext,"(*)");
	q_votequestion=replace(q_intertext,"("+q_options+")","");
	q_option=q_options.split(",");
}else{
	q_votequestion="";
	q_option=new Array("","","","","","");
}//end if
q_html="<tr><td id='text18' colspan='3' style='padding-left:5px; padding-right:5px;' class='i_label'>"+q_help+"</td></tr>"+
"<tr><td colspan='3' style='padding-left:5px; padding-right:5px;' class='i_label'>"+
"<textarea class='i_input' name='textparameter3' rows='3' style='width:100%;' onfocus='Interaction_setEditing(true)' onblur='Interaction_setEditing(false)'>"+
q_votequestion+"</textarea><br>"+
"Answer Options:<br>";
for (q_i=1;q_i<=6;q_i++){
	if(q_option[q_i-1]){
		q_html=q_html + q_i+".&nbsp;<input name='LABEL' type='text' class='i_input' size='12' maxlength='30' value='" + q_option[q_i-1] + "'>&nbsp;&nbsp;";
	}else{
		q_html=q_html + q_i+".&nbsp;<input name='LABEL' type='text' class='i_input' size='12' maxlength='30' value=''>&nbsp;&nbsp;";
	}//end if
	if(q_i%2==0){
		q_html=q_html + "<br>";
	}//end if
}//next
var q_goto=WildFind(0,q_intertext,"GOTO(*)");
if(q_goto==""){
	q_html=q_html+"<br><input type=checkbox>Conditional Goto:<input id='GOTO' name='GOTO' type='text' class='i_input' size='12' maxlength='30' value=''>";
}else{
	q_html=q_html+"<br><input type=checkbox checked>Conditional Goto:<input id='GOTO' name='GOTO' type='text' class='i_input' size='12' maxlength='30' value='"+q_goto+"'>";
}//end if
q_html=q_html+"</td></tr>";
return q_html;
}//end function

function ipar19_html(q_obj,q_intertext,q_help){
return "<tr><td colspan='3'><textarea id='textparameter' name='textparameter' class='i_input' style='width:100%; height:232px; ' onfocus='Interaction_setEditing(true)' onblur='Interaction_setEditing(false)'>"+q_intertext+"</textarea></td></tr>";
}//end function

function i_html2(){
return 0;
}//end function

function i_html3(){
return 0;
}//end function

function getRZchart(q_x0,q_x1,q_x2,q_x3,q_x4,q_x5,q_y0,q_y1,q_y2,q_y3,q_y4,q_y5){
//old entrypoint for backward compatibility
q_obj=document.getElementById("inter");
q_INTERWIDTH=parseInt(q_obj.style.width)-10;
q_INTERHEIGHT=parseInt(q_obj.style.height);
return q_getRZchart3(1,q_INTERWIDTH-5,(q_INTERHEIGHT/2),q_y0,q_x0,q_y1,q_x1,q_y2,q_x2,q_y3,q_x3,q_y4,q_x4,q_y5,q_x5);
}//end function

function getRZchartp(q_x0,q_x1,q_x2,q_x3,q_x4,q_x5,q_y0,q_y1,q_y2,q_y3,q_y4,q_y5){
//old entrypoint for backward compatibility
q_obj=document.getElementById("inter");
q_INTERWIDTH=parseInt(q_obj.style.width)-10;
q_INTERHEIGHT=parseInt(q_obj.style.height);
return q_getRZchart3(0,q_INTERWIDTH-5,(q_INTERHEIGHT/2),q_y0,q_x0,q_y1,q_x1,q_y2,q_x2,q_y3,q_x3,q_y4,q_x4,q_y5,q_x5);
}//end function

function q_getRZchart4(q_type,q_width,q_height,q_intertext){
var q_options=WildFind(0,q_intertext,"(*)");
var q_results=WildFind(0,q_intertext,"("+q_options+")(*)");
if((q_options=="")||(q_results=="")){
	return "";
}else{
	q_option=q_options.split(",");
	q_result=q_results.split(",");
	return q_options+"("+q_results+")";
}//end if
}//end function

function q_getRZchart3(){
var q_SHOWTOTAL=q_getRZchart3.arguments[0];
var q_width=q_getRZchart3.arguments[1];
var q_height=q_getRZchart3.arguments[2];
var q_h=q_height/(q_getRZchart3.arguments.length-3);
if(q_h>10) q_h=10;
var q_t=7;
var q_sum=0;
var q_maxlen1=0;
var q_maxlen2=0;
var q_maxlen3=0;

for (q_i=3;q_i<q_getRZchart3.arguments.length;q_i++){
   if((q_i%2)==1){
      if(q_maxlen1<("" + q_getRZchart3.arguments[q_i]).length){
         q_maxlen1=(""+q_getRZchart3.arguments[q_i]).length;
	  }//end if
   }else{
      if(q_maxlen2<q_getRZchart3.arguments[q_i]){
         q_maxlen2=q_getRZchart3.arguments[q_i];
		 if(q_SHOWTOTAL==1){
         	q_maxlen3=(""+q_getRZchart3.arguments[q_i]).length;
		}else{
			q_maxlen3= (Math.floor(100*parseInt(q_getRZchart3.arguments[q_i+1])/q_sum)+"%").length;
		  }//end if
	  }//end if
	  q_sum=q_sum+parseInt(q_getRZchart3.arguments[q_i]);
   }//end if
}//next
if(q_sum==0){
	q_SHOWTOTAL=1;
}//end if

var q_scale=(q_width-20-q_maxlen1*q_t-q_maxlen3*q_t)/q_maxlen2;
q_html="<TABLE id='voteresultchart' name='voteresultchart' class=i_label WIDTH=" +q_width+" style='border-width=0;border-style:solid;' border=0 cellpadding=1 cellspacing=0 >";
for (q_i=3;q_i<q_getRZchart3.arguments.length;q_i=q_i+2){
if(q_getRZchart3.arguments[q_i]){
if(q_getRZchart3.arguments[q_i]!==""){
	if(q_SHOWTOTAL==1){
		q_html=q_html+"<TR HEIGHT="+(q_h+q_h)+"><TD width="+(q_maxlen1*q_t)+">"+q_getRZchart3.arguments[q_i]+"</TD><TD><IMG SRC='../../../program/livepro/images/bar"+((q_i-1)/2)+".gif' HEIGHT="+q_h+"  WIDTH="+(q_getRZchart3.arguments[q_i+1]*q_scale) +" BORDER=1></TD><TD width="+(q_maxlen3*q_t)+" align=right>"+q_getRZchart3.arguments[q_i+1]+"</TD></TR>"; 
	}else{
		q_html=q_html+"<TR HEIGHT="+(q_h+q_h)+"><TD width="+(q_maxlen1*q_t)+">"+q_getRZchart3.arguments[q_i]+"</TD><TD><IMG SRC='../../../program/livepro/images/bar"+((q_i-1)/2)+".gif' HEIGHT="+q_h+"  WIDTH="+(q_getRZchart3.arguments[q_i+1]*q_scale) +" BORDER=1></TD><TD width="+(q_maxlen3*q_t)+" align=right>"+Math.floor(100*parseInt(q_getRZchart3.arguments[q_i+1])/q_sum)+"%</TD></TR>"; 
	}//end if
}//end if
}//end if
}//next
q_html=q_html+"</TABLE>";
return q_html;
}//end function

loadedInteraction=true;
//END CLASS
