var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
function setHref(obj,div){
	w = document.getElementById(div).offsetWidth+30;
	h = document.getElementById(div).offsetHeight+30;
	obj.href += "&amp;width=" + w + "&amp;height=" + h;
	obj.onclick = "";
}
function displayFieldSet(obj){
	obj.parentNode.parentNode.lastChild.style.display = (obj.checked) ? "block" : "none";;
}
function setFormButtons(obj){
}
function maxCheck(obj,nb){
	if(nb > 0){
		nTot = 0;
		cBoxes = document.getElementsByName(obj.name);
		for(var i=0;i<cBoxes.length;i++){
			if(cBoxes[i].checked && cBoxes[i] != obj){
				nTot++;
				if(nTot >= nb){
					cBoxes[i].checked = false;
				}
			}
		}
	}
}
function showHideCell(art,cell){
	var td = document.getElementById("c" + art + "_" + cell);
	if(td){
		if(td.style.display == "none"){
			td.style.display = "";
		}
		else {
			td.style.display = "none";
		}
	}
}
function showAndHideCell(obj,art,shw,hid){
	/*obj.form["FLD" + obj.value].value = returnBoolean(obj.checked);*/
	var td_1 = document.getElementById("c" + art + "_" + shw);
	var td_2 = document.getElementById("c" + art + "_" + hid);
	if(obj.checked){
		st_1 = "";
		st_2 = "none";
	}
	else {
		st_1 = "none";
		st_2 = "";
	}
	oDate = new Date(2100, 12, 31, 0, 0, 0);
	if(td_1) {
		td_1.style.display = st_1;
		document.cookie = "c" + art + "_" + shw + "=" + st_1 + ";expires=" + oDate;
	}
	if(td_2){
		td_2.style.display = st_2;
		document.cookie = "c" + art + "_" + hid + "=" + st_2 + ";expires=" + oDate;
	}
}

var navId = 1;
function navHover(){
	var navs = document.getElementsByName("nav-" + navId);
	for(var j=0; j<navs.length; j++){
		var lis = navs[j].childNodes;
		for (var i=0; i<lis.length; i++) {
			if(lis[i].lastChild.tagName == "UL"){
				lis[i].onmouseover=function() {
					this.lastChild.style.display = "block";
				}
				lis[i].onmouseout=function() {
					this.lastChild.style.display = "none";
				}
			}
		}
	}
}
function insertTag(tag){
	switch(tag){
		case "Bold":
			t = "b";
			x = prompt(tag,"Text");
		break;
		case "Italic":
			t = "i";
			x = prompt(tag,"Text");
		break;
		case "Underline":
			t = "u";
			x = prompt(tag,"Text");
		break;
		case "StrikeThrough":
			t = "s";
			x = prompt(tag,"Text");
		break;
		case "Link":
			t = "a";
			x = prompt(tag,"http://");
		break;
		case "Picture":
			t = "img";
			x = prompt(tag,"http://");
		break;
	}
	if(x){
		document.forumForm["POST"].value += "[" + t + "]" + x + "[/" + t + "]";
	}
	return false;
}
function insertTag(tag, obj){
	switch(tag){
		case "Bold":
			t = "b";
			x = prompt(tag,"Text");
		break;
		case "Italic":
			t = "i";
			x = prompt(tag,"Text");
		break;
		case "Underline":
			t = "u";
			x = prompt(tag,"Text");
		break;
		case "StrikeThrough":
			t = "s";
			x = prompt(tag,"Text");
		break;
		case "Link":
			t = "a";
			x = prompt(tag,"http://");
		break;
		case "Picture":
			t = "img";
			x = prompt(tag,"http://");
		break;
	}
	if(x){
		obj.form.TEXT.value += "[" + t + "]" + x + "[/" + t + "]";
	}
	return false;
}

var sLastShowHideElement = null;
var oLastobj = null;
function ShowHideElement(p_sElement, p_displayType)
{
	if (sLastShowHideElement != null)
	{
		oLastobj = document.getElementById(sLastShowHideElement);
	}
	if (oLastobj != null && sLastShowHideElement != p_sElement)
	{
		oLastobj.style.display = "none";
	}	
	sLastShowHideElement = p_sElement;
	var obj = document.getElementById(p_sElement);
	if (obj)
	{
		var displayType = (obj.style.display == 'none' || obj.style.display == 'hidden') ? p_displayType : "none";
		obj.style.display = displayType;
	}
	
}
function addAreaRows(){
	document.forumForm["POST"].rows += 5; 
}
function showFieldSet(obj,parent,quoted){
	document.getElementById("oLabelEditor").innerText = obj.innerText;
	document.forumForm["PARENT_ID"].value = parent;
	document.forumForm["QUOTED"].value = quoted;
}
function SMC(depth,id){
	document.cookie = "MENU=" + depth + "-" + id + ";expires=" + expireDate + ";path=/";
	return true;
}
function insertFlash(id,src,width,height,align,fla){
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + width + '" height="' + height + '" id="obj' + id + '" align="' + align + '">');
	document.write('<param name="movie" value="' + src + '" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<param name="allowFullScreen" value="true" />');
	if(fla && fla.length > 0){
		document.write('<param name="flashvars" value="' + fla + '" />');
	}
	document.write('<embed src="' + src + '" quality="high" wmode="transparent" allowFullScreen="true" width="' + width + '" height="' + height + '" name="obj' + id + '" align="' + align + '"');
	if(fla && fla.length > 0){
		document.write(' flashvars="' + fla + '"');
	}
	document.write(' type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"></embed></object>');
}
function setFocus(obj,b){
	if(b == true && obj.value == obj.defaultValue) obj.value = "";
	obj.className = "focus";
}
function setBlur(obj){
	obj.className = "text";
}
var curPoll = null;
function answerPoll(obj){
	curPoll = obj.getElementsByTagName("DIV")[0];
	for(i=2;i<obj.elements.length;i++){
		if(obj.elements[i].checked) return true;
	}
	return false;
}
function validateLen(obj){
	if(obj.value.length == 0){
		alert(obj.title);
		if(obj.type != "hidden"){
			obj.focus();
		}
		return false;
	}
	else return true;
}
function isSelected(obj,msg){
	if(obj.value == 0){
		alert(msg);
		obj.focus();
		return false;
	}
	else return true;
}
function isChecked(nam){
	oColl = document.getElementsByName(nam);
	for(var i=0;i<oColl.length;i++){
		if(oColl[i].checked){
			return true;
		}
	}
	alert("Error");
	return false;
}
function isRadioChecked(obj,nam,msg){
	valid = false;
	for(i=0;i<obj.elements.length;i++){
		if(obj.elements[i].name == nam && obj.elements[i].checked){
			valid = true;
			break;
		}
	}
	if(!valid){
		alert(msg);
		for(i=0;i<obj.elements.length;i++){
			if(obj.elements[i].name == nam){
				obj.elements[i].focus();
				break;
			}
		}
	}
	return valid;
}
function validEmail(obj,msg){
	var valid = true;
	i1 = obj.value.indexOf("@");
	if (i1 < 1) valid = false;
	else {
		i2 = obj.value.indexOf(".", i1);
		if(i2 - i1 < 2) valid = false;
		if(i2 == obj.value.length - 1) valid= false;
	}
	if (!valid){ 
		alert(msg);
		obj.select();
	}
	return valid;
}
function isInteger(obj,msg){
	if(isNaN(obj.value) || (obj.value.indexOf(".") != -1)){
		alert(msg);
		obj.select();
		return false;
	}
	else return true;
}
function isFloat(obj,msg){
	if(isNaN(obj.value)){
		alert(msg);
		obj.select();
		return false;
	}
	else return true;
}
function allDay(obj,i){
	if(i > 0) dis = true;
	else dis = false;
	obj["HOUR"].disabled = dis;
	obj["MINUTE"].disabled = dis;
	obj["HOUR_END"].disabled = dis;
	obj["MINUTE_END"].disabled = dis;
}
function openWindow(url,wid,hei,nam,scr,res){
	var win = window.open(url,"" + nam + "","screenX=30,left=30,scrollbars=" + scr + ",toolbar=0,location=0,directories=0,statusbar=0,menubar=0,resizable=" + res + ",screenY=30,top=30,width=" + wid + ",height=" + hei + "");	
	win.focus();
	return false;
}
function checkFields(obj){
	for(var i=0;i<obj.form.elements.length;i++){
		if(obj.form.elements[i].parent == obj.id){
			switch (eval(obj.form.elements[i].name)){
				case 17:
					var sUrl = returnURL(document.getElementById("Ifr" + obj.name).src,"SEL,FLD") + "&FLD=" + obj.form.elements[i].id + "&SEL=" + obj.value;
					document.getElementById("Ifr" + obj.form.elements[i].name).src = sUrl;
				break;
				case 19:
					var sUrl = document.getElementById("Ifr" + obj.form.elements[i].name).src;
					document.getElementById("Ifr" + obj.form.elements[i].name).src = returnURL(sUrl,"VAL") + "&VAL=" + obj.value;
				break;
			}
		}
	}
}
function returnURL(myURL,mySTR){
	strArray = mySTR.split(',');
	tmpURL = myURL.toString();
	x = tmpURL.indexOf('?');
	if(x > 0){
		defURL = tmpURL.substring(0,x);
		locURL = tmpURL.substring(x+1).split('&');
		for(var i=0;i<locURL.length;i++){
			tmp = true;
			for(var j=0;j<strArray.length;j++){
				tmpLOC = locURL[i].substring(0,locURL[i].indexOf('='));
				if(tmpLOC == strArray[j]){
					tmp = false;
				}
			}
			if (tmp){
				if (defURL.indexOf('?') == -1) defURL += "?" + locURL[i];
				else defURL += "&" + locURL[i];
			}
		}
	}
	else defURL = tmpURL + "?x=0"
	return defURL;
}

function SwapPicture(p_sImgId, p_iFileId)
{
	var obj = document.getElementById(p_sImgId);
	if (obj)
	{
		obj.src = "/files/fil_" + p_iFileId;
	}
}
function getHttpRequest(file){
if(window.XMLHttpRequest) // FIREFOX
xhr_object = new XMLHttpRequest();
else if(window.ActiveXObject) // IE
xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
else
return(false);
xhr_object.open("GET", file, false);
xhr_object.send(null);
if(xhr_object.readyState == 4) return(xhr_object.responseText);
else return(false);
}
