//GP812 Translit code
var transliticflag = 0;
var pretransliticflag = 0;
var processhtmltags = 0;
var processbbcodetags = 0;

var lat = ('/E_/e_/O_/o_Шh_Йo_Зh_Цh_Сh_Йe_Йu_Йa_Ыo_Ыu_Ыa_ШH_ЙO_ЗH_ЦH_СH_ЙE_ЙU_ЙA_ЫO_ЫU_ЫA_A_B_V_G_D_E_Z_I_J_K_L_M_N_O_P_R_S_T_U_F_X_C_ъ#_Y_ь\'_H_W_Q_шh_йo_зh_цh_сh_йe_йu_йa_ыo_ыu_ыa_a_b_v_g_d_e_z_i_j_k_l_m_n_o_p_r_s_t_u_f_x_c_#_y_\'_h_w_q_'+String.fromCharCode(220)+'_'+String.fromCharCode(214)+'_'+String.fromCharCode(196)+'_'+String.fromCharCode(252)+'_'+String.fromCharCode(246)+'_'+String.fromCharCode(228)).split('_');
var rus = ('E_e_O_o_Щ_Ё_Ж_Ч_Ш_Э_Ю_Я_Ё_Ю_Я_Щ_Ё_Ж_Ч_Ш_Э_Ю_Я_Ё_Ю_Я_А_Б_В_Г_Д_Е_З_И_Й_К_Л_М_Н_О_П_Р_С_Т_У_Ф_Х_Ц_Ъ_Ы_Ь_Х_Щ_Я_щ_ё_ж_ч_ш_э_ю_я_ё_ю_я_а_б_в_г_д_е_з_и_й_к_л_м_н_о_п_р_с_т_у_ф_х_ц_ъ_ы_ь_х_щ_я_Ю_Ё_Э_ю_ё_э').split('_');
var rus2 = ('Щ_Ё_Ж_Ч_Ш_Э_Ю_Я_А_Б_В_Г_Д_Е_З_И_Й_К_Л_М_Н_О_П_Р_С_Т_У_Ф_Х_Ц_Ъ_Ы_Ь_щ_ё_ж_ч_ш_э_ю_я_а_б_в_г_д_е_з_и_й_к_л_м_н_о_п_р_с_т_у_ф_х_ц_ъ_ы_ь').split('_');
var lat2 = ('Shh_Jo_Zh_Ch_Sh_Je_Ju_Ja_A_B_V_G_D_E_Z_I_J_K_L_M_N_O_P_R_S_T_U_F_H_C_##_Y_\'\'_shh_jo_zh_ch_sh_je_ju_ja_a_b_v_g_d_e_z_i_j_k_l_m_n_o_p_r_s_t_u_f_h_c_#_y_\'').split('_');

if (document.images) {
	swnormal_src = new Image;
	swnormal_src = "http://www.ritterclan.org/images/translit.gif";
	swtranslitic_src = new Image;
	swtranslitic_src = "http://www.ritterclan.org/images/translit_chk.gif";
}

function setfoc()
{
	document.commentform.com_text.focus();
	return false;
}

function changelanguage()
{
	if (!transliticflag) {
		transliticflag=1;
		document.images['translitic'].src = swtranslitic_src;
		var helpline=document.getElementById('helpline');
		if(helpline){
			helpline.innerHTML='<b>Траслит:</b> Shh->Щ Jo->Ё Zh->Ж Ch->Ч Sh->Ш Je->Э Ju->Ю Ja->Я Y->Ы #->Ъ \'->ь x->х';
		}

	}
	else {
		transliticflag=0;
		document.images['translitic'].src = swnormal_src;
		var helpline=document.getElementById('helpline');
		if(helpline){
			helpline.innerHTML=''
		}
	}
	setfoc();
	return false;
}

function settranslitic()
{
	transliticflag=1;
	document.images['translitic'].src = swtranslitic_src;
	setfoc();
	return false;
}

function setnormal()
{
	transliticflag=0;
	document.images['translitic'].src = swnormal_src;
	setfoc();
	return false;
}

function translate_letter(textEl,event)
{
	var code = event.keyCode;
	var txt = String.fromCharCode(code);

	if (processhtmltags&&(txt=='<')) {
		pretransliticflag=transliticflag;
		setnormal();
	}
	if (processhtmltags&&(txt=='>')) {
		if(pretransliticflag) settranslitic(); else setnormal();
	}
	if (processbbcodetags&&(txt=='[')) {
		pretransliticflag=transliticflag;
		setnormal();
	}
	if (processbbcodetags&&(txt==']')) {
		if(pretransliticflag) settranslitic(); else setnormal();
	}
	cursor_pos_selection = document.selection.createRange(); //make selection
	cursor_pos_selection.text=""; //delete something is selected before
	cursor_pos_selection.moveStart("character",-1); //get the previous character
	pretxt = cursor_pos_selection.text;

	if (pretxt.length>1) pretxt="";
	event.keyCode = 0;
        if (transliticflag)
        {
        	result = translatesymboltocyrillic(pretxt+txt); // to cyrillic

        }
        else
        {
        	result = pretxt+txt;  // no transormation
        }
	if (pretxt!="") { //delete the previous symbol if it exists (if the entered symbol is not the first one)
	cursor_pos_selection.select();
		cursor_pos_selection.collapse();
	}
	with(document.selection.createRange()) {
		text = result;
		collapse();
		select()
	}
	return false;
}

function translatesymboltocyrillic(txt)
{
	var pos = void 0;
	for (var ii=0; ii<lat.length; ii++)
	{
		pos = txt.length>lat[ii].length?(txt.length-lat[ii].length):0;
		if (lat[ii]==txt.substr(pos,txt.length-pos)) {
			return txt.substr(0,txt.length-lat[ii].length)+rus[ii];
		}
	}
	return txt;
}

function translatesymboltolatin(symb)
{	return symb; //don't convert cyr to lat (Alex Nomad)
	//for (var ii=0;ii<rus2.length;ii++)
	//{
	//	if (rus2[ii]==symb)
	//	return lat2[ii];
	//}
	//return symb;
}


//GP812 Translit code end 



function xoopsFormValidate_commentform() {
	myform = window.document.commentform;
if ( myform.com_text.value == "" ) { window.alert("пожалуйста введите Сообщение"); myform.com_text.focus(); return false; }
return true;
}




function AddSelectedText(BBOpen, BBClose) {
		var txt_range_obj = document.selection.createRange();  
		 if (txt_range_obj.parentElement().tagName!="TEXTAREA") 
		     alert("Для этой операции необходимо выделить участок текста."); 
	   else 
	       txt_range_obj.text=BBOpen+txt_range_obj.text+BBClose; 
    }

 function InsertBBCode(BBcode){
			AddSelectedText("[" + BBcode + "]","[/" + BBcode + "]");
 	  }
 	  
 function InsertNick(){
	var nick = document.selection.createRange();  
	 if (nick.parentElement().tagName!="TEXTAREA") 
	     alert("Для этой операции необходимо выделить участок текста."); 
	  else 
	      nick.text="[nick level=]"+nick.text+"[/nick]"; 
}

function InsertKlan(){
	var klan =document.selection.createRange(); 
	if (klan.parentElement().tagName!="TEXTAREA") 
	     alert("Для этой операции необходимо выделить участок текста."); 
	  else 
	      klan.text="[clan]"+klan.text+"[/clan]";
}	

function InsertKlanImg(id,listValue){
		if(listValue==null ||listValue=='') return;
		listValue=listValue.replace('|',']');
		var domobj = xoopsGetElementById(id);
	    var result = "[clanimg=" + listValue  + "[/clanimg]";
		xoopsInsertText(domobj, result);
}

function InsertKlanName(id,listValue){
		if(listValue==null ||listValue=='') return;
		listValue=listValue.replace('|',']');
		var domobj = xoopsGetElementById(id);
	    var result = "[clan=" + listValue  + "[/clan]";
		xoopsInsertText(domobj, result);
}


function InsertReason(){
	var reason =document.selection.createRange(); 
	if (reason.parentElement().tagName!="TEXTAREA") 
	     alert("Для этой операции необходимо выделить участок текста."); 
	  else 
	      reason.text="[haos]"+reason.text+"[/haos]";
}	


function InsertColor(value){
	if(value==null ||value=='') return;
	var messagetext =document.selection.createRange(); 
	if (messagetext.parentElement().tagName!="TEXTAREA") 
	     alert("Для этой операции необходимо выделить участок текста."); 
	  else 
	      messagetext.text="[color="+value+"]"+messagetext.text+"[/color]";
}

function InsertFont(value){
	if(value==null ||value=='') return;
	var messagetext =document.selection.createRange(); 
	if (messagetext.parentElement().tagName!="TEXTAREA") 
	     alert("Для этой операции необходимо выделить участок текста."); 
	  else 
	      messagetext.text="[font="+value+"]"+messagetext.text+"[/font]";
}

function InsertSize(value){
	if(value==null ||value=='') return;
	var messagetext =document.selection.createRange(); 
	if (messagetext.parentElement().tagName!="TEXTAREA") 
	     alert("Для этой операции необходимо выделить участок текста."); 
	  else 
	      messagetext.text="[size="+value+"]"+messagetext.text+"[/size]";
}


function MakeUpdate(id){
	var domobj = xoopsGetElementById(id);
	var result = "[color=FF0000][b]Update: [/b][/color]";
	xoopsInsertText(domobj, result);
	domobj.focus();
}


function GenerateNumber() {
    var length=8;
    var sNumber = "";    
    var noPunction = true;    
    for (i=0; i < length; i++) {
        numI = getRandomNum();
        if (noPunction) { while (checkPunc(numI)) { numI = getRandomNum(); } }
        sNumber = sNumber + String.fromCharCode(numI);
    }
	return sNumber;
}

function getRandomNum() {
    // between 0 - 1
    var rndNum = Math.random()
    // rndNum from 0 - 1000
    rndNum = parseInt(rndNum * 1000);
    // rndNum from 33 - 127
    rndNum = (rndNum % 94) + 33;
    return rndNum;
}

function checkPunc(num) {
    if ((num >=33) && (num <=47)) { return true; }
    if ((num >=58) && (num <=64)) { return true; }
    if ((num >=91) && (num <=96)) { return true; }
    if ((num >=123) && (num <=126)) { return true; }
    return false;
}



function MakeInvisible(){
	//var id = GenerateNumber();
	var InvisText =document.selection.createRange(); 
	
	if (InvisText.parentElement().tagName!="TEXTAREA") 
	     alert("Для этой операции необходимо выделить участок текста."); 
	  else {
		  //id = "a"+id+"b";
		  //InvisText.text="[ht_"+id+"]"+InvisText.text+"[/ht_"+id+"]";}
		  InvisText.text="[ht show=\"Показать\" hide=\"Спрятать\"]"+InvisText.text+"[/ht]";}
}


function htf(id,show){
	var showed = document.getElementById("shhd_"+id+"_show");
	var hided = document.getElementById("shhd_"+id);
	var hidedbody = document.getElementById("shhd_"+id+"_body");
	if(show){
		showed.style.display="none";
		hided.style.display="";
		if(hidedbody)
			hidedbody.style.display="";
	}else{
		showed.style.display="";
		hided.style.display="none";
		if(hidedbody)
			hidedbody.style.display="none";
	}
}



function xoopsGetElementById(id){
	if (document.getElementById) {
		return (document.getElementById(id));
	} else if (document.all) {
		return (document.all[id]);
	} else {
		if ((navigator.appname.indexOf("Netscape") != -1) && parseInt(navigator.appversion == 4)) {
			return (document.layers[id]);
		}
	}
}

function xoopsSetElementProp(name, prop, val) {
	var elt=xoopsGetElementById(name);
	if (elt) elt[prop]=val;
}

function xoopsSetElementStyle(name, prop, val) {
	var elt=xoopsGetElementById(name);
	if (elt && elt.style) elt.style[prop]=val;
}

function xoopsGetFormElement(fname, ctlname) {
	var frm=document.forms[fname];
	return frm?frm.elements[ctlname]:null;
}

function justReturn() {
	return;
}

function openWithSelfMain(url,name,width,height,returnwindow) {
	var options = "width=" + width + ",height=" + height + ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no";

	var new_window = window.open(url, name, options);
	window.self.name = "main";
	new_window.focus();
	if (returnwindow != null) {
	   return new_window;
	}
}

function setElementColor(id, color){
	xoopsGetElementById(id).style.color = "#" + color;
}

function setElementFont(id, font){
	xoopsGetElementById(id).style.fontFamily = font;
}

function setElementSize(id, size){
	xoopsGetElementById(id).style.fontSize = size;
}

function changeDisplay(id){
	var elestyle = xoopsGetElementById(id).style;
	if (elestyle.display == "") {
		elestyle.display = "none";
	} else {
		elestyle.display = "block";
	}
}

function setVisible(id){
	xoopsGetElementById(id).style.visibility = "visible";
}

function setHidden(id){
	xoopsGetElementById(id).style.visibility = "hidden";
}

function makeBold(id){
	var eleStyle = xoopsGetElementById(id).style;
	if (eleStyle.fontWeight != "bold" && eleStyle.fontWeight != "700") {
		eleStyle.fontWeight = "bold";
	} else {
		eleStyle.fontWeight = "normal";
	}
}

function makeItalic(id){
	var eleStyle = xoopsGetElementById(id).style;
	if (eleStyle.fontStyle != "italic") {
		eleStyle.fontStyle = "italic";
	} else {
		eleStyle.fontStyle = "normal";
	}
}

function makeUnderline(id){
	var eleStyle = xoopsGetElementById(id).style;
	if (eleStyle.textDecoration != "underline") {
		eleStyle.textDecoration = "underline";
	} else {
		eleStyle.textDecoration = "none";
	}
}

function makeLineThrough(id){
	var eleStyle = xoopsGetElementById(id).style;
	if (eleStyle.textDecoration != "line-through") {
		eleStyle.textDecoration = "line-through";
	} else {
		eleStyle.textDecoration = "none";
	}
}

function appendSelectOption(selectMenuId, optionName, optionValue){
	var selectMenu = xoopsGetElementById(selectMenuId);
	var newoption = new Option(optionName, optionValue);
	selectMenu.options[selectMenu.length] = newoption;
	selectMenu.options[selectMenu.length].selected = true;
}

function disableElement(target){
	var targetDom = xoopsGetElementById(target);
	if (targetDom.disabled != true) {
		targetDom.disabled = true;
	} else {
		targetDom.disabled = false;
	}
}
function xoopsCheckAll(formname, switchid) {
	var ele = document.forms[formname].elements;
	var switch_cbox = xoopsGetElementById(switchid);
	for (var i = 0; i < ele.length; i++) {
		var e = ele[i];
		if ( (e.name != switch_cbox.name) && (e.type == 'checkbox') ) {
			e.checked = switch_cbox.checked;
		}
	}
}

function xoopsCheckGroup(formname, switchid, groupid) {
	var ele = document.forms[formname].elements;
	var switch_cbox = xoopsGetElementById(switchid);
	for (var i = 0; i < ele.length; i++) {
		var e = ele[i];
		if ( (e.type == 'checkbox') && (e.id == groupid) ) {
			e.checked = switch_cbox.checked;
			e.click(); e.click();  // Click to activate subgroups
									// Twice so we don't reverse effect
		}
	}
}

function xoopsCheckAllElements(elementIds, switchId) {
	var switch_cbox = xoopsGetElementById(switchId);
	for (var i = 0; i < elementIds.length; i++) {
		var e = xoopsGetElementById(elementIds[i]);
		if ((e.name != switch_cbox.name) && (e.type == 'checkbox')) {
			e.checked = switch_cbox.checked;
		}
	}
}

function xoopsSavePosition(id)
{
	var textareaDom = xoopsGetElementById(id);
	if (textareaDom.createTextRange) {
		textareaDom.caretPos = document.selection.createRange().duplicate();
	}
}

function xoopsInsertText(domobj, text)
{
	if (domobj.createTextRange && domobj.caretPos){
  		var caretPos = domobj.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) 
== ' ' ? text + ' ' : text;  
	} else if (domobj.getSelection && domobj.caretPos){
		var caretPos = domobj.caretPos;
		caretPos.text = caretPos.text.charat(caretPos.text.length - 1)  
== ' ' ? text + ' ' : text;
	} else {
		domobj.value = domobj.value + text;
  	}
}

function xoopsCodeSmilie(id, smilieCode) {
	var revisedMessage;
	var textareaDom = xoopsGetElementById(id);
	xoopsInsertText(textareaDom, smilieCode);
	textareaDom.focus();
	return;
}

function showImgSelected(imgId, selectId, imgDir, extra, xoopsUrl) {
	if (xoopsUrl == null) {
		xoopsUrl = "./";
	}
	imgDom = xoopsGetElementById(imgId);
	selectDom = xoopsGetElementById(selectId);
	imgDom.src = xoopsUrl + "/"+ imgDir + "/" + selectDom.options[selectDom.selectedIndex].value + extra;
}

function xoopsCodeUrl(id, enterUrlPhrase, enterWebsitePhrase){
var urlsrc;
var selectedtext =document.selection.createRange(); 
		
	if (selectedtext.parentElement().tagName!="TEXTAREA") 
	     alert("Для этой операции необходимо выделить участок текста."); 
	  else {
	  		if (enterUrlPhrase == null)
	  			enterUrlPhrase = "Enter the URL of the link you want to add:";	
		  	var urlsrc= prompt(enterUrlPhrase, "");
			if ( urlsrc!= null && urlsrc!= "")
				selectedtext.text = "[url=" + urlsrc + "]" + selectedtext.text + "[/url]";
	  }
}

function xoopsCodeImg(id, enterImgUrlPhrase, enterImgPosPhrase, imgPosRorLPhrase, errorImgPosPhrase){
	if (enterImgUrlPhrase == null) {
		enterImgUrlPhrase = "Enter the URL of the image you want to add:";
	}
	var text = prompt(enterImgUrlPhrase, "");
	var domobj = xoopsGetElementById(id);
	if ( text != null && text != "" ) {
		if (enterImgPosPhrase == null) {
			enterImgPosPhrase = "Now, enter the position of the image.";
		}
		if (imgPosRorLPhrase == null) {
			imgPosRorLPhrase = "'R' or 'r' for right, 'L' or 'l' for left, or leave it blank.";
		}
		if (errorImgPosPhrase == null) {
			errorImgPosPhrase = "ERROR! Enter the position of the image:";
		}
		var text2 = prompt(enterImgPosPhrase + "\n" + imgPosRorLPhrase, "");
		while ( ( text2 != "" ) && ( text2 != "r" ) && ( text2 != "R" ) && ( text2 != "l" ) && ( text2 != "L" ) && ( text2 != null ) ) {
			text2 = prompt(errorImgPosPhrase + "\n" + imgPosRorLPhrase,"");
		}
		if ( text2 == "l" || text2 == "L" ) {
			text2 = " align=left";
		} else if ( text2 == "r" || text2 == "R" ) {
			text2 = " align=right";
		} else {
			text2 = "";
		}
		var result = "[img" + text2 + "]" + text + "[/img]";
		xoopsInsertText(domobj, result);
	}
	domobj.focus();
}

function xoopsCodeEmail(id, enterEmailPhrase){
	var selectedtext =document.selection.createRange(); 
	if (selectedtext.parentElement().tagName!="TEXTAREA") 
	     alert("Для этой операции необходимо выделить участок текста."); 
	  else 
	      selectedtext.text="[email]"+selectedtext.text+"[/email]";
}

function xoopsCodeQuote(id, enterQuotePhrase){
	var selectedtext =document.selection.createRange(); 
	if (selectedtext.parentElement().tagName!="TEXTAREA") 
	     alert("Для этой операции необходимо выделить участок текста."); 
	  else 
	      selectedtext.text="[quote]"+selectedtext.text+"[/quote]";
}

function xoopsCodeCode(){
	var selectedtext =document.selection.createRange(); 
	if (selectedtext.parentElement().tagName!="TEXTAREA") 
	     alert("Для этой операции необходимо выделить участок текста."); 
	  else 
	      selectedtext.text="[code]"+selectedtext.text+"[/code]";
}

function xoopsCodeText(id, hiddentext, enterTextboxPhrase){
	var textareaDom = xoopsGetElementById(id);
	var textDom = xoopsGetElementById(id + "Addtext");
	var fontDom = xoopsGetElementById(id + "Font");
	var colorDom = xoopsGetElementById(id + "Color");
	var sizeDom = xoopsGetElementById(id + "Size");
	var xoopsHiddenTextDomStyle = xoopsGetElementById(hiddentext).style;
	var textDomValue = textDom.value;
	var fontDomValue = fontDom.options[fontDom.options.selectedIndex].value;
	var colorDomValue = colorDom.options[colorDom.options.selectedIndex].value;
	var sizeDomValue = sizeDom.options[sizeDom.options.selectedIndex].value;
	if ( textDomValue == "" ) {
		if (enterTextboxPhrase == null) {
			enterTextboxPhrase = "Please input text into the textbox.";
		}
		alert(enterTextboxPhrase);
		textDom.focus();
	} else {
		if ( fontDomValue != "FONT") {
			textDomValue = "[font=" + fontDomValue + "]" + textDomValue + "[/font]";
			fontDom.options[0].selected = true;
		}
		if ( colorDomValue != "COLOR") {
			textDomValue = "[color=" + colorDomValue + "]" + textDomValue + "[/color]";
			colorDom.options[0].selected = true;
		}
		if ( sizeDomValue != "SIZE") {
			textDomValue = "[size=" + sizeDomValue + "]" + textDomValue + "[/size]";
			sizeDom.options[0].selected = true;
		}
		if (xoopsHiddenTextDomStyle.fontWeight == "bold" || xoopsHiddenTextDomStyle.fontWeight == "700") {
			textDomValue = "[b]" + textDomValue + "[/b]";
			xoopsHiddenTextDomStyle.fontWeight = "normal";
		}
		if (xoopsHiddenTextDomStyle.fontStyle == "italic") {
			textDomValue = "[i]" + textDomValue + "[/i]";
			xoopsHiddenTextDomStyle.fontStyle = "normal";
		}
		if (xoopsHiddenTextDomStyle.textDecoration == "underline") {
			textDomValue = "[u]" + textDomValue + "[/u]";
			xoopsHiddenTextDomStyle.textDecoration = "none";
		}
		if (xoopsHiddenTextDomStyle.textDecoration == "line-through") {
			textDomValue = "[d]" + textDomValue + "[/d]";
			xoopsHiddenTextDomStyle.textDecoration = "none";
		}
		xoopsInsertText(textareaDom, textDomValue);
		textDom.value = "";
		xoopsHiddenTextDomStyle.color = "#000000";
		xoopsHiddenTextDomStyle.fontFamily = "";
		xoopsHiddenTextDomStyle.fontSize = "12px";
		xoopsHiddenTextDomStyle.visibility = "hidden";
		textareaDom.focus();
	}
}

function xoopsValidate(subjectId, textareaId, submitId, plzCompletePhrase, msgTooLongPhrase, allowedCharPhrase, currCharPhrase) {
	var maxchars = 65535;
	var subjectDom = xoopsGetElementById(subjectId);
	var textareaDom = xoopsGetElementById(textareaId);
	var submitDom = xoopsGetElementById(submitId);
	if (textareaDom.value == "" || subjectDom.value == "") {
		if (plzCompletePhrase == null) {
			plzCompletePhrase = "Please complete the subject and message fields.";
		}
		alert(plzCompletePhrase);
		return false;
	}
	if (maxchars != 0) {
		if (textareaDom.value.length > maxchars) {
			if (msgTooLongPhrase == null) {
				msgTooLongPhrase = "Your message is too long.";
			}
			if (allowedCharPhrase == null) {
				allowedCharPhrase = "Allowed max chars length: ";
			}
			if (currCharPhrase == null) {
				currCharPhrase = "Current chars length: ";
			}
			alert(msgTooLongPhrase + "\n\n" + allowedCharPhrase + maxchars + "\n" + currCharPhrase + textareaDom.value.length + "");
			textareaDom.focus();
			return false;
		} else {
			submitDom.disabled = true;
			return true;
		}
	} else {
		submitDom.disabled = true;
		return true;
	}
}


function openMinWnd(url,name,width,height,returnwindow) {
var options = "width=" + width + ",height=" + height + ",toolbar=no,location=yes,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no";
	if(url.indexOf("?")!=-1) { url= url+"&rnd="+Math.random();}
	else { url= url+"?rnd="+Math.random();}
	var new_window = window.open(url, name, options);
	window.self.name = "main";
	new_window.focus();
	if (returnwindow != null) {
	   return new_window;
	}
}




blinkingblocks=new Array();
blinkingblocks_state=0;
blinkingblocks_use=0;


function blinkblockstick() {
	if(blinkingblocks.length==0) return;
	for(i in blinkingblocks){
		if(blinkingblocks_state==0)
			blinkingblocks[i][0].style.backgroundColor=blinkingblocks[i][1];
		else 
			blinkingblocks[i][0].style.backgroundColor=blinkingblocks[i][2];
	}
	blinkingblocks_state= (blinkingblocks_state==0) ? 1 : 0 ;
}

function addblinkblock(obj, bgcolor1, bgcolor2) {
	i=blinkingblocks.length;
	blinkingblocks[i] = new Array();
	blinkingblocks[i][0]=obj;
	blinkingblocks[i][1]=bgcolor1;
	blinkingblocks[i][2]=bgcolor2;
	if(blinkingblocks_use==0) {
		blinkingblocks_use=1;
		setInterval("blinkblockstick()",500);
	}
}


