

var fNavO = function(oSource, sOriginalState, bOn){
	if(oSource.getAttribute('init_state') != 'on'){
		if(bOn){
			oSource.src = aNavImages_on[oSource.getAttribute('navindex')].src;
		}else{
			oSource.src = aNavImages_off[oSource.getAttribute('navindex')].src;
		}
	}
}

var fPopUp = function(sHref, nMode){
	var winPopup = [];
	
	switch(nMode){
		case 1: // Forum Message
			winPopup[nMode] = window.open(sHref, 'winPopup' + nMode, 'toolbar=no, status=no, menubar=no, scrollbars=yes, movable=yes, resizable=no, width=600, height=500');
			break;
		case 2: // Icon List
			winPopup[nMode] = window.open(sHref, 'winPopup' + nMode, 'toolbar=no, status=no, menubar=no, scrollbars=yes, movable=yes, resizable=no, width=400, height=200');
			break;
		default:
			winPopup[nMode] = window.open(sHref, 'winPopup' + nMode, '');
			break;
	}
}

var fFitWindowSize = function(oContainer){
	window.resizeTo(oContainer.offsetWidth + 20, oContainer.offsetHeight + 85);
}

var fCenterWindow = function(oWindow){
	var nY = new Number((window.screen.availHeight - oWindow.document.body.offsetHeight) / 2 - 200);
	var nX = new Number((window.screen.availWidth - oWindow.document.body.offsetWidth) / 2);
	oWindow.moveTo(nX, nY);
}

var fCenterElement = function(sElement){
	var oElement = $(sElement);
	oElement.setStyle('top', (document.body.offsetHeight / 2) - (oElement.getSize().size.y / 2));
	oElement.setStyle('left', (document.body.offsetWidth / 2) - (oElement.getSize().size.x / 2));
}

var fCheckEmail = function(sEmail){
	var reFilter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if (reFilter.test(sEmail)){
		return true;
	}else{
		return false;
	}
}

var fSwitch = function(sElement){
	if($(sElement).getStyle('display') == 'none'){
		$(sElement).setStyle('display', 'block');
	}else{
		$(sElement).setStyle('display', 'none');
	}
}

/*var fPollVote = function(nPollID){
	var nAnswerID = new Number(0);
	for(var nIndex = 0; nIndex < 10; nIndex++){
		if(document.getElementById('txtPoll' + nPollID + '_' + nIndex)){
			if(document.getElementById('txtPoll' + nPollID + '_' + nIndex).checked){
				nAnswerID = document.getElementById('txtPoll' + nPollID + '_' + nIndex).value;
				break;
			}
		}
	}
	
	if(nAnswerID > 0){
		location.href = '/Polls.asp?txtActionID=1&txtPollID=' + nPollID + '&txtAnswerID=' + nAnswerID;
	}else{
		alert('נא בחר/י תשובה מהסקר');
	}
}*/

var fTableRowHighlight = function(oSource, bOver){
	var oRow = oSource.parentNode;
	for(var nIndex = 0; nIndex < oRow.childNodes.length; nIndex++){
		if(oRow.childNodes[nIndex].tagName == 'TD'){
			oRow.childNodes[nIndex].style.backgroundColor = bOver ? '#F4F4F4' : '#E4E4E4';
			oRow.childNodes[nIndex].style.color = bOver ? '#BC1F25' : '#000';
		}
	}
}

var fParseRSS = function (sRSS, sTarget){
	var xmlobject = (new DOMParser()).parseFromString(sRSS, "text/xml");
	
	var root = xmlobject.getElementsByTagName('rss')[0];

	$(sTarget).setHTML('<textarea cols="30" rows="10">' + sRSS + '</textarea>');
}

var fBlinkComment = function(nItemID){
	var oContainer = $('divComment' + nItemID);
	var oElement = $('divCommentContainer' + nItemID)
	var nHeight = oElement.getSize().size.y;
	var oBlink = new Fx.Style(oContainer, 'height', {duration: 500, transition: Fx.Transitions.Cubic.easeOut});
	if(oContainer.getSize().size.y > 1){
		oBlink.start(0).chain(function(){
			//fInitSlider(g_nMainSliderPos);
		});
	}else{
		oBlink.start(nHeight).chain(function(){
			//fInitSlider(g_nMainSliderPos);
		});
	}
}

var fSwitchAdminMenu = function(oSource){
	var oMenuContent = $('divAbsAdminMenu');
	var oMenu = $('divAdminMenu');
	var oFx1 = new Fx.Styles(oMenu, {wait: true, duration: 700, transition: Fx.Transitions.Elastic.easeOut});
	var oFx2 = new Fx.Style(oMenuContent, 'opacity', {wait: false, duration: 500, transition: Fx.Transitions.Cubic.easeOut});
	if(oMenu){
		if(oMenu.getAttribute('active') == 0){
			oMenu.setStyles({'display': 'block', 'opacity': 0.75});
			var nWidth = oMenuContent.getSize().size.x;
			var nHeight = oMenuContent.getSize().size.y;
			//alert([nWidth, nHeight]);
			oMenuContent.setStyle('opacity', 0);
			oFx1.start({'width': nWidth, 'height': nHeight}).chain(function(){
				oFx2.start(1);
			});
			oMenu.setAttribute('active', 1);
		}else{
			oFx1 = new Fx.Styles(oMenu, {wait: false, duration: 300, transition: Fx.Transitions.Cubic.easeOut});
			oFx2.start(0).chain(function(){
				oFx1.start({'width': '0px', 'height': '0px'}).chain(function(){
					oMenu.setStyles({'display': 'none'});
				});
			});
			oMenu.setAttribute('active', 0);
		}
	}
	/*oMenu = null;
	oMenuContent = null;
	oFx1 = null;
	oFx2 = null;*/
}

window.addEvent('domready', function(){
	
});

window.addEvent('load', function(){

});

window.addEvent('resize', function(){

});



