
function ExistSelection(p_objName)
{
	var elems;
	var isOk = false;
	elems = document.form1.elements[p_objName];
	if(elems.length)
	{
		for (i=0;i<elems.length;i++)
		{
			if(elems[i].checked == true)
			{
				isOk = true;
				break;
			}
		}
	}
	else
	{
		if(elems.checked == true)
		isOk = true;
	}
	return isOk;
}

function MM_nbGroup(event, grpName) { //v3.0
	var i,img,nbArr,args=MM_nbGroup.arguments;
	if (event == "init" && args.length > 2) {
		if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
			img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
			if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
			nbArr[nbArr.length] = img;
			for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
				if (!img.MM_up) img.MM_up = img.src;
				img.src = img.MM_dn = args[i+1];
				nbArr[nbArr.length] = img;
			} }
	} else if (event == "over") {
		document.MM_nbOver = nbArr = new Array();
		for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
			if (!img.MM_up) img.MM_up = img.src;
			img.src = (img.MM_dn && args[i+2]) ? args[i+2] : args[i+1];
			nbArr[nbArr.length] = img;
		}
	} else if (event == "out" ) {
		for (i=0; i < document.MM_nbOver.length; i++) {
			img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
	} else if (event == "down") {
		if ((nbArr = document[grpName]) != null)
		for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
		document[grpName] = nbArr = new Array();
		for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
			if (!img.MM_up) img.MM_up = img.src;
			img.src = img.MM_dn = args[i+1];
			nbArr[nbArr.length] = img;
		} }
}


function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
		if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
		for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
		if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

function MM_displayStatusMsg(msgStr) { //v1.0
	status=msgStr;
	document.MM_returnValue = true;
}

function MM_callJS(jsStr) { //v2.0
	return eval(jsStr)
}

function MM_goToURL() { //v3.0
	var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
	for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_checkPlugin(plgIn, theURL, altURL, autoGo) { //v4.0
	var ok=false; document.MM_returnValue = false;
	with (navigator) if (appName.indexOf('Microsoft')==-1 || (plugins && plugins.length)) {
		ok=(plugins && plugins[plgIn]);
	} else if (appVersion.indexOf('3.1')==-1) { //not Netscape or Win3.1
		if (plgIn.indexOf("Flash")!=-1 && window.MM_flash!=null) ok=window.MM_flash;
		else if (plgIn.indexOf("Director")!=-1 && window.MM_dir!=null) ok=window.MM_dir;
		else ok=autoGo; }
		if (!ok) theURL=altURL; if (theURL) window.location=theURL;
}
var g_bLoaded;
g_bLoaded = true;
function showWaitDiv()
{
	if(! g_bLoaded && parent.document&& parent.document.all.wait){
		parent.document.all.wait.style.visibility = "visible";
	}
}
function onDocComplete(){
	if(parent && parent.document.all.wait)
	{
		if((document.readyState=="complete")){
			parent.document.all.wait.style.visibility = "hidden";
		}
	}
}
function submitForm()
{
	document.form1.submit();
}

function submitFormDelayed()
{
	submitForm();
	g_bLoaded = false;
	setTimeout("showWaitDiv()",100);
}

function window_onload(){
	if(parent && parent.document.all.wait)
	{
		if((document.readyState=="complete")){
			parent.document.all.wait.style.visibility = "hidden";
		}
	}
	if(document && document.pag_int && document.all.wait)
	{
		if((document.pag_int.document.readyState=="complete") && document.all.wait){
			document.all.wait.style.visibility = "hidden";
		}
	}
};

function window_onbeforeunload () {
	setTimeout(' if(document && (document.readyState!="complete"))'+
	'     if(parent.document && parent.document.all.wait){'+
	'          parent.document.all.wait.style.visibility = "visible";};'+
	' if(document.pag_int && document.pag_int.document && document.all.wait '+
	'    && document.pag_int.document.readyState!="complete"){'+
	'   document.all.wait.style.visibility = "visible";}',300);
};



function checkRadioSelected(p_radio,p_form,p_message)
{
	var bChecked,i;
	bChecked =  false;
	if(p_radio){
		if(p_radio.length){
			for(i=0;i<p_radio.length;i++){
				if(p_radio[i].checked){
					i = p_radio.length;
					bChecked = true;
				}
			}
		}else{
			bChecked = p_radio.checked;
		}
	}
	if(bChecked){
		p_form.submit();
	}else{
		alert(p_message);
	}
}


function isMailValid(str) {

	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
		return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		return false
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		return false
	}
	if (str.indexOf(at,(lat+1))!=-1){
		return false
	}
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false
	}
	if (str.indexOf(dot,(lat+2))==-1){
		return false
	}
	if (str.indexOf(" ")!=-1){
		return false
	}
	return true
}



function isNumeric(sText,otherChars)
{
	var ValidChars = "0123456789";
	var IsNumber=true;
	var Char;
	if (otherChars!="")
	ValidChars += otherChars;

	for (i = 0; i < sText.length && IsNumber == true; i++)
	{
		Char = sText.charAt(i);
		if (ValidChars.indexOf(Char) == -1)
		{
			IsNumber = false;
		}
	}
	return IsNumber;

}


function ConfirmPassword(p_field1,p_field2)
{
	if((p_field1.value=='')||(p_field2.value==''))
	{
		alert('Parola incorecta!');
		return false;
	}

	if(p_field1.value != p_field2.value)
	{
		alert('Confirmati parola!');
		return false;
	}
	return true;

}


function resetTemplateForm()
{
	document.getElementById("idName").value = "";
	document.getElementById("idCompany").value = "";
	document.getElementById("idEmail").value = "";
	document.getElementById("idPhone").value = "";
	document.getElementById("idSubject").value = "";
	document.getElementById("idBody").value = "";
	document.getElementById("idSecurityCode").value = "";
}

function submitGlobalSearchForm()
{
	var form1 = document.getElementById("frmGlobalSearch");
	var stype = document.getElementById("ddlGlobalSearch").value;
	var skey = document.getElementById("Key").value;
	form1.action = "index.php?s=" + stype;
	if(skey != "")
	form1.submit();

}





/************************************************************************************************************
LAST HOUR TABS
************************************************************************************************************/

function changeTab (id,tabslist) {
	var tabs = tabslist.split(";");
	for(var i=0;i<tabs.length;i++)
	{
		if (id==tabs[i]+'Div') {
			document.getElementById(tabs[i]+'Div').className='articleRightListTitle1Selected';
			document.getElementById(tabs[i]).className='articleListUlSelected';
		}
		else
		{
			document.getElementById(tabs[i]+'Div').className='articleRightListTitle1';
			document.getElementById(tabs[i]).className='articleListUl';
		}
	}
}


function changeTabWithCss (id,tabslist,cssclass) {
	var tabs = tabslist.split(";");
	for(var i=0;i<tabs.length;i++)
	{
		if (id==tabs[i]+'Div') {
			document.getElementById(tabs[i]+'Div').className='articleRightListTitle1Selected';
			document.getElementById(tabs[i]).className=cssclass+'Selected';
		}
		else
		{
			document.getElementById(tabs[i]+'Div').className='articleRightListTitle1';
			document.getElementById(tabs[i]).className=cssclass;
		}
	}
}


/************************************************************************************************************
COVER ARTICLE
************************************************************************************************************/

function highlite(id){
	var nr = id.substr(4);

	for (var i=1;i<=3;i++)
	{
		if (i!=nr) {
			document.getElementById('news'+i).className='shortNews';
		}
		else {
			document.getElementById('news'+i).className='shortNewsSelect';
		}
	}

	document.getElementById('linkCover').href= document.getElementById('linkCover'+nr).href;
	document.getElementById('imgCover').src= document.getElementById('imgCover'+nr).src;

	if (nr=="1")
	{
		document.getElementById('newsArrow1').className="imageNewsArrowTop";
	}
	else if (nr=="2")
	{
		document.getElementById('newsArrow1').className="imageNewsArrowMiddle";
	}
	else if (nr=="3")
	{
		document.getElementById('newsArrow1').className="imageNewsArrowBottom";
	}

}

function highliteGreen(id){
	var nr = id.substr(4);

	for (var i=1;i<=3;i++)
	{
		if (i!=nr) {
			document.getElementById('news'+i).className='shortNewsGreen';
		}
		else {
			document.getElementById('news'+i).className='shortNewsSelectGreen';
		}
	}


	document.getElementById('linkCover').href= document.getElementById('linkCover'+nr).href;
	document.getElementById('imgCover').src= document.getElementById('imgCover'+nr).src;

	if (nr=="1")
	{
		document.getElementById('newsArrowGreen').className="imageNewsArrowTopGreen";
	}
	else if (nr=="2")
	{
		document.getElementById('newsArrowGreen').className="imageNewsArrowMiddleGreen";
	}
	else if (nr=="3")
	{
		document.getElementById('newsArrowGreen').className="imageNewsArrowBottomGreen";
	}
}

/*function highlitegreen(id){
	var nr = id.substr(4);
	for (var i=1;i<=3;i++){
		if (i!=nr) {
			document.getElementById('newsArrow'+i).style.display='none';
			document.getElementById('imageCover'+i).style.display='none';
			document.getElementById('news'+i).className='shortNewsGreen';
		}
		else {
			document.getElementById('newsArrow'+i).style.display='block';
			document.getElementById('imageCover'+i).style.display='block';
			document.getElementById('news'+i).className='shortNewsSelectGreen';
		}
	}
}*/

/************************************************************************************************************
CHANGE FONT SIZE
************************************************************************************************************/

function changeFontSize (id)
{
	var className = document.getElementById('contentNews').className;
	if (className == 'articleContentNews')
		document.getElementById('contentNews').className = 'articleContentNewsBigSize';
	else
		document.getElementById('contentNews').className = 'articleContentNews';
}



/************************************************************************************************************
SEND EMAIL WITH ARTICLE
************************************************************************************************************/

function showPopup(id) {
	if (navigator.appName=="Microsoft Internet Explorer") {
		document.body.scroll = 'no';
	}
	else
	{
		document.body.style.overflow = "hidden";
	}


	show_disabler(true,30);
/*	var size = getSize();
	var div = document.getElementById(id);
	div.style.left = (size[0]/2)-150+"px";
	div.style.top = (size[1]/2)-150+"px";
	div.style.display='block';*/


//	var size = getPageSize();
	var size = getSize();
	var div = document.getElementById(id);
	div.style.left = (size[0]/2)-150+"px";

	switch (navigator.appName)
	{
		case "Netscape":
			scroll_top = document.body.scrollTop;
			break;
		case "Microsoft Internet Explorer":
			scroll_top = document.documentElement.scrollTop;
			break;
		case "Opera":
			scroll_top = document.body.scrollTop;
			break;
		case "Firefox":
			scroll_top = document.body.scrollTop;
			break;
		case "Microsoft Internet Explorer":
			scroll_top = document.body.scrollTop;
			break;
		default:
			scroll_top = document.body.scrollTop;
			break;
	}


	div.style.top = scroll_top +(size[1]/2)-150+"px";

	div.style.display='block';

	resetValues(id);
}


function showPopup2(id, width, height) {
/*	if (navigator.appName=="Netscape") {
		document.body.style.overflow = "hidden";
	}
*/	if (navigator.appName=="Microsoft Internet Explorer") {
		document.body.scroll = 'no';
	}
	else
	{
		document.body.style.overflow = "hidden";
	}

	show_disabler(true,30);
/*    var arrayPageScroll = document.viewport.getScrollOffsets();
	var size = getPageSize();
	var div = document.getElementById(id);
	div.style.left = (size[0]/2)-(width/2)+"px";
	div.style.top = "5px";//(size[1]/2)-(height/2)+"px";*/
	var size = getSize();
	var div = document.getElementById(id);
	div.style.left = (size[0]/2)-(width/2)+"px";
	div.style.top = "5px";//(size[1]/2)-(height/2)+"px";
	div.style.display='block';
}

function show_disabler(value, alpha)
{
	var div = document.getElementById('disabler');
	if (div != null)
	{
		if (value)
		{
			div.style.opacity = alpha / 100;
			div.style.filter = 'alpha(opacity=' + alpha + ')';
			div.style.left = 0;
			div.style.top = 0;
			//var size = getSize();
			var size = getPageSize();
			div.style.position = 'absolute';
			div.style.width = size[0]+"px";

			switch (navigator.appName)
			{
				case "Opera":
					datatnt_link = document.getElementById('datatnt_link');
					div.style.height = getY(datatnt_link)+30+"px";
					break;
				default:
					div.style.height = size[1]+"px";
					break;
			}


			div.style.display = 'block';
		}
		else
		{
			div.style.width = 1;
			div.style.height = 1;
			div.style.display = 'none';
		}
	}
}



function getY( oElement )
{
	var iReturnValue = 0;
	while( oElement != null )
	{
		iReturnValue += oElement.offsetTop;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}


function resetValues(id)
{
	if(id=='contentEmail')
	{
		document.getElementById('from_name').value = '';
		document.getElementById('from_email').value = '';
		document.getElementById('to_name').value='';
		document.getElementById('to_email').value='';
		document.getElementById('SecurityCodeEmail').value = '';
		return;
	}
	if(id=='contentNewsletter')
	{
		document.getElementById('contact_name').value = '';
		document.getElementById('contact_email').value = '';
		document.getElementById('SecurityCodeNewsletter').value = '';
		return;
	}
	if(id=='contentClient')
	{
		document.getElementById('client_name').value = '';
		document.getElementById('client_email').value = '';
		document.getElementById('client_job').value = '';
		document.getElementById('client_profession').value = '';
		document.getElementById('client_age').value = '';
		document.getElementById('SecurityCodeClient').value = '';
		return;
	}
}

function cancel(id) {
	if (navigator.appName=="Netscape") {
		document.body.style.overflow = "auto";
	}
	if (navigator.appName=="Microsoft Internet Explorer") {
		document.body.scroll = 'yes';
	}

	show_disabler(false,100);
	var div = document.getElementById(id);
	div.style.display='none';
}

function sendEmail(id, articolId) {
	var message = checkEmailFields();
	if(message=='')
	{
		//cancel(id);
		//document.getElementById('send_by_email').submit();


		vote = new sack();
		vote.methos='POST';
		vote.setVar('from_name',document.getElementById('from_name').value);
		vote.setVar('from_email',document.getElementById('from_email').value);
		vote.setVar('to_name',document.getElementById('to_name').value);
		vote.setVar('to_email',document.getElementById('to_email').value);
		vote.setVar('id',articolId );
		vote.setVar('SecurityCodeEmail',document.getElementById('SecurityCodeEmail').value);

		document.getElementById('temp_container').style.display= 'block';
		document.getElementById('send_email_div').style.display = 'none';
		vote.requestFile='index_ajax.php?cmd=send_email';
		vote.onCompletion = function()
		{

			if (vote.response.indexOf('error')==-1)
			{
				alert('Articolul a fost trimis');

			}
			else
			{
				alert('Cod de securitate incorect!');
			}
			cancel('contentEmail');
			document.getElementById('send_email_div').style.display='block';
			document.getElementById('temp_container').style.display='none';
		};
		vote.runAJAX();
	}
	else{
		alert(message);
	}
}

function checkEmailFields() {
	var message = "";
	var from_name = document.getElementById('from_name').value;
	var from_email = document.getElementById('from_email').value;
	var to_name = document.getElementById('to_name').value;
	var to_email = document.getElementById('to_email').value;
	var security = document.getElementById('SecurityCodeEmail').value;

	if((from_name=='') || (from_email=='') || (to_name=='') ||(to_email=='') || (security==''))
	message = "Toate campurile trebuie completate.";
	else{
		if(!isMailValid(to_email))
		message = "Emailul destinatarului este incorect.";
		else{
			if(!isMailValid(from_email))
			message = "Emailul expeditorului este incorect.";
		}
	}
	return message;
}

function getSize()
{
	var myWidth = 0;
	var myHeight = 0;
	if (typeof(window.innerWidth) == 'number')
	{
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	}
	else
	{
		if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
		{
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		}
		else
		if (document.body && (document.body.clientWidth || document.body.clientHeight))
		{
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		}
	}
	return [myWidth, myHeight];
}


    function getPageSize() {

	     var xScroll, yScroll;

		if (window.innerHeight && window.scrollMaxY) {
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}

		var windowWidth, windowHeight;

		if (self.innerHeight) {	// all except Explorer
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth;
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}

		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else {
			pageHeight = yScroll;
		}

		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){
			pageWidth = xScroll;
		} else {
			pageWidth = windowWidth;
		}

		return [pageWidth,pageHeight];
	}










//newsletter
function checkNewsletterFields() {
	var message = "";
	var contact_name = document.getElementById('contact_name').value;
	var contact_email = document.getElementById('contact_email').value;
	var security = document.getElementById('SecurityCodeNewsletter').value;

	if((contact_name=='') || (contact_email=='') || (security==''))
	message = "Toate campurile cu \"*\" trebuie completate.";
	else{
		if(!isMailValid(contact_email))
		message = "Emailul este incorect.";
	}
	return message;
}


function donewsletter() {
	var message = checkNewsletterFields();
	if(message=='')
	{
		cancel('contentNewsletter');
		document.getElementById('frmNewsletter').submit();
	}
	else{
		alert(message);
	}
}



//possible client / the one who access PUBLICITATE
function checkClientFields() {
	var message = "";
	var client_name = document.getElementById('client_name').value;
	var client_email = document.getElementById('client_email').value;
	var security = document.getElementById('SecurityCodeClient').value;

	if((client_name=='') || (client_email=='') || (security==''))
	message = "Toate campurile cu \"*\" trebuie completate.";
	else{
		if(!isMailValid(client_email))
		message = "Emailul este incorect.";
	}
	return message;
}


function doclient() {
	var message = checkClientFields();
	if(message=='')
	{
		cancel('contentClient');
		document.getElementById('frmClient').submit();
	}
	else{
		alert(message);
	}
}

/************************************************************************************************************
SEARCH
************************************************************************************************************/

function dosearch(idform) {
	var message = checkSearchFields();
	if(message=='')
	{
		document.getElementById(idform).submit();
	}
	else{
		alert(message);
	}
}

function checkSearchFields() {
	var message = "";
	var search_text = document.getElementById('search_text').value;
	if(search_text=='')
	message = "Introduceti textul de cautat!";

	return message;
}




/************************************************************************************************************
COMMENTS
************************************************************************************************************/

function addComment(id) {
	if(id==null) id = '';
	var message = checkCommentFields(id);
	if(message=='')
	{
		document.getElementById('frmComment'+id).submit();
	}
	else{
		alert(message);
	}
}

function checkCommentFields(id) {
	var message = "";
	var form = document.getElementById('frmComment'+id);
	var comment_name = document.getElementById('comment_name'+id).value;
	var comment_subject = document.getElementById('comment_subject'+id).value;
	var comment_body = document.getElementById('comment_body'+id).value;
	var security = document.getElementById('SecurityCodeComment'+id).value;
	if((comment_name=='') || (comment_subject=='') || (comment_body=='') || (security==''))
	message = "Toate campurile trebuie completate.";

	return message;
}


/************************************************************************************************************
RESET SEARCH FORM
************************************************************************************************************/

function ResetSearchForm() {
	document.getElementById('valToSearch').value="";
	document.getElementById('chkCheckArchieve').checked=false;
	document.getElementById('idPublishDate1').value="";
	document.getElementById('idPublishDate2').value="";
}




/************************************************************************************************************
(C) www.dhtmlgoodies.com, November 2005

This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.

Terms of use:
You are free to use this script as long as the copyright message is kept intact. However, you may not
redistribute, sell or repost it without our permission.

Thank you!

www.dhtmlgoodies.com
Alf Magne Kalleland

************************************************************************************************************/

var dhtmlgoodies_slideSpeed = 30;	// Higher value = faster
var dhtmlgoodies_timer = 10;	// Lower value = faster

var objectIdToSlideDown = false;
var dhtmlgoodies_activeId = false;
var dhtmlgoodies_slideInProgress = false;
function showHideContent(e,inputId)
{
	if(dhtmlgoodies_slideInProgress)return;
	dhtmlgoodies_slideInProgress = true;
	if(!inputId)inputId = this.id;
	inputId = inputId + '';
	var numericId = inputId.replace(/[^0-9]/g,'');
	var answerDiv = document.getElementById('dhtmlgoodies_a' + numericId);

	objectIdToSlideDown = false;

	if(!answerDiv.style.display || answerDiv.style.display=='none'){
		if(dhtmlgoodies_activeId &&  dhtmlgoodies_activeId!=numericId){
			objectIdToSlideDown = numericId;
			slideContent(dhtmlgoodies_activeId,(dhtmlgoodies_slideSpeed*-1));
		}else{

			answerDiv.style.display='block';
			answerDiv.style.visibility = 'visible';

			slideContent(numericId,dhtmlgoodies_slideSpeed);
		}
	}else{
		slideContent(numericId,(dhtmlgoodies_slideSpeed*-1));
		dhtmlgoodies_activeId = false;
	}
}

function slideContent(inputId,direction)
{

	var obj =document.getElementById('dhtmlgoodies_a' + inputId);
	var contentObj = document.getElementById('dhtmlgoodies_ac' + inputId);
	height = obj.clientHeight;
	if(height==0)height = obj.offsetHeight;
	height = height + direction;
	rerunFunction = true;
	if(height>contentObj.offsetHeight){
		height = contentObj.offsetHeight;
		rerunFunction = false;
	}
	if(height<=1){
		height = 1;
		rerunFunction = false;
	}

	obj.style.height = height + 'px';
	var topPos = height - contentObj.offsetHeight;
	if(topPos>0)topPos=0;
	contentObj.style.top = topPos + 'px';
	if(rerunFunction){
		setTimeout('slideContent(' + inputId + ',' + direction + ')',dhtmlgoodies_timer);
	}else{
		if(height<=1){
			obj.style.display='none';
			if(objectIdToSlideDown && objectIdToSlideDown!=inputId){
				document.getElementById('dhtmlgoodies_a' + objectIdToSlideDown).style.display='block';
				document.getElementById('dhtmlgoodies_a' + objectIdToSlideDown).style.visibility='visible';
				slideContent(objectIdToSlideDown,dhtmlgoodies_slideSpeed);
			}else{
				dhtmlgoodies_slideInProgress = false;
			}
		}else{
			dhtmlgoodies_activeId = inputId;
			dhtmlgoodies_slideInProgress = false;
		}
	}
}

function textCounter(field, countfield, maxlimit)
{
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
countfield.value = maxlimit - field.value.length;
}

function initShowHideDivs()
{
	var divs = document.getElementsByTagName('DIV');
	var divCounter = 1;
	for(var no=0;no<divs.length;no++){
		if(divs[no].className=='dhtmlgoodies_question'){
			divs[no].onclick = showHideContent;
			divs[no].id = 'dhtmlgoodies_q'+divCounter;
			var answer = divs[no].nextSibling;
			while(answer && answer.tagName!='DIV'){
				answer = answer.nextSibling;
			}
			answer.id = 'dhtmlgoodies_a'+divCounter;
			contentDiv = answer.getElementsByTagName('DIV')[0];
			contentDiv.style.top = 0 - contentDiv.offsetHeight + 'px';
			contentDiv.className='dhtmlgoodies_answer_content';
			contentDiv.id = 'dhtmlgoodies_ac' + divCounter;
			answer.style.display='none';
			answer.style.height='1px';
			divCounter++;
		}
	}
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

window.onload = initShowHideDivs;


/************************************************************************************************************
END www.dhtmlgoodies.com

************************************************************************************************************/