/*                                                                             */
/*      Discussion forum v1.0.2                                                  */
/*      Created by IBM Corporation 2008 in Sweden (Lars Nicander/Sweden/IBM)   */
/*                                                                             */
/*      This version is made for Sweden in Swedish. To make a country          */
/*      specific version of this, please just make a copy of this file         */
/*      and translate all text that's written in swedish to the current        */
/*      language. When this is done, place it in a central country/language    */
/*      directory on any IBM Internet server.                                  */
/*                                                                             */
/*      Except this file you would need a forum specific config file           */
/*      with specifications of the current data for the forum.                 */
/*      An example of a file like this can be found at:                        */
/*           http://w3.nordic.ibm.com/events/se/softwareday/js/forum.js        */
/*      To make it possible to search i a forum you also need a search form.   */
/*      An example of these can be found here:                                 */
/*           http://w3.nordic.ibm.com/events/se/softwareday/chat.html          */
/*                                                                             */
/*      Please do not change ANYTHING in the functions. Just update            */
/*      the variables values.                                                  */
/*                                                                             */
/*      To get admin access to a forum created with this scripts, please       */
/*      contact Lars Nicander/Sweden/IBM                                       */
/*                                                                             */


validate_title_alert="Vänligen fyll i en rubrik för inlägget.";
validate_signature_alert="Vänligen skriv en signatur.";
confirm_admin_delete_post="Är du säker på att du vill radera posten?";
show_all_forum_records="Alla inlägg";
send_answer="Besvara";
show_chain="Visa kedja";
show_question="Visa fråga";
show_answers="Visa svar";
delete_record="Radera";


function validateChatForm(checkform) {
	if(checkform.title.value=="") {
		alert(validate_title_alert);
		checkform.title.focus();
		return false;
	};
	if(checkform.signature.value=="") {
		alert(validate_signature_alert);
		checkform.signature.focus();
		return false;
	};
	return true;
}

function confirmCleanUp() {
	if (confirm(confirm_admin_delete_post)) return true;
	else return false;
}

function printData(color,title,datetime,body,id,thread,answer,nranswer,admin,chid,signature,catColors) {
	if(catColors != "undefined") {
		colorArray=catColors.split(",");
	} else
		colorArray=["green", "yellow", "blue", "red", "purple"];
	if(parseInt(color)>0) printColor=' class="'+colorArray[parseInt(color)-1]+'"'; else printColor='';
	document.write('<tr><td'+printColor+'><b>'+title+'</b> ■</td><td align=right>'+datetime+'</td></tr>\n');
	document.write('<tr><td colspan=2>'+body+'</td></tr>\n');
	document.write('<tr><td><a href=?num=0 class=small style="text-decoration:none;">'+show_all_forum_records+'</a> &nbsp; <a href=?parent='+id+' class=small style="text-decoration:none;">'+send_answer+'</a> &nbsp; <a href=?thread='+thread+' class=small style="text-decoration:none;">'+show_chain+'</a>'+(answer>0?' &nbsp; <a href=?question='+answer+' class=small style="text-decoration:none;">'+show_question+'</a>':'')+(nranswer>0?'	&nbsp; <a href=?answer='+id+' class=small style="text-decoration:none;">'+show_answers+'</a>':'')+(admin==1?' &nbsp; <a href=?del='+id+'&chid='+chid+' class=small style="text-decoration:none;" onClick="return confirmCleanUp();">'+delete_record+'</a>':'')+'</td><td align=right>'+signature+'</td></tr>\n');
	document.write('<tr height="20"><td colspan=2><div class="ibm-rule"><hr /></div></td></tr>\n');
}

function getw3ibmProfile() {
	cookies=document.cookie.split(/w3ibmProfile=/);
	if(cookies[0]!=document.cookie) {
		cookies=cookies[1].split(";");
		cookies=cookies[0].split("|");
		return cookies[0];
	} else return "0";
}

function getChatPage(forum,chatURI,catNum,catColors,catNames) {
	document.write('<scrip'+'t language="javascript" src="http://'); js='';
	document.write((location.host.substring(0,3)=="www"?'www'+'-'+'0'+'5'+''+'-':location.host.substring(0,10)));
	document.write('ibm.com/se/include/v16/chat.'+js);
	document.write('p'+'hp?chid='+forum+'&'+location.search.substr(1)+'&chatURI='+chatURI+'&catNum='+catNum+'&catColors='+catColors+'&catNames='+catNames+'&w3id='+getw3ibmProfile()+'"></scr'+'ipt>');
	return true;
}