function hideById(id)
{
	document.getElementById(id).style.display = 'none';
}

function showById(id)
{
	document.getElementById(id).style.display = 'block';
}
function openFAQ(id){
	var faqlist = document.getElementById('faqCount').value;
	
	for(i=0;i<=faqlist;i++){
		hideById('a_'+i);
	}
	
	showById(id);
	
	return false;
}

function HighlightProd(id){
	 
 	var idProds = document.getElementById('idProds').value;
	var products = idProds.split(",");
	for(prods in products){
	var idProd = products[prods];
		if(products[prods]!=Number.NaN){
	//if(!(parseint(idProd).isNaN))
			document.getElementById('Introprods_'+idProd).className = 'introProd';
		//	alert('Introprods_'+products[prods]);
		}
	}
//	alert("Introprods_ "+id);
	if(id>0){
	//	alert("Introprods_ "+id);
		document.getElementById('Introprods_'+id).className = 'introProdHighlight';
	}
}

function isInteger(n) {
return (!isNaN(n)) && (Math.floor(n)==n)
}


/*-----------------------------------------------------------
Toggles element's display value
Input: any number of element id's
Output: none 
---------------------------------------------------------*/
function toggleDisp() {
for (var i=0;i<arguments.length;i++){
    var d = $(arguments[i]);
    if (d.style.display == 'none')
        d.style.display = 'block';
    else
        d.style.display = 'none';
}
}

                
function toggle(num,numelems){
	
	for (var i=1;i<=numelems;i++){
		hideById('tabContent'+i);
		document.getElementById('tabHeader'+i).className = '';
	}
	showById('tabContent'+num);
	document.getElementById('tabHeader'+num).className = 'current';
}
function toggleGroupEdit(num,numelems){
	
	for (var i=1;i<=numelems;i++){
		hideById('groupedit_'+i);
	}
	showById('groupedit_'+num);
	
	return false;
}
function toggleContactEdit(num,numelems){
	
	for (var i=1;i<=numelems;i++){
		hideById('cntctedit_'+i);
	}
	showById('cntctedit_'+num);
	
	return false;
}

function updatecustomform(element,value){
	var elm = document.getElementById('DakorForm');
	//alert(element+" "+value);
	switch(element){
		case "DakorForm":
			elm.style.width = value+"px";
		break;
		case "MainBorderColour":
			elm.style.border = "1px solid #"+value;
			
		break;
		case "DakorFormh2":
			document.getElementById('DakorForm_H2').innerHTML = value;
		break;
		case "h2bckgrnd":
			document.getElementById('DakorForm_H2').style.backgroundColor = "#"+value;
		break;
		case "h2txtcolor":
			document.getElementById('DakorForm_H2').style.color = "#"+value;
		break;
	}
}

function resetdefaults(id){
	
	
	var elmts = Array(1);
	elmts['DakorForm'] = 200;
	elmts['MainBorderColour'] = '000000';
	elmts['DakorFormh2'] = 'Keep Informed';
	elmts['h2bckgrnd'] = 'FFCC66';
	elmts['h2txtcolor'] = '366024';
	
	for(i in elmts){
		
		if(document.getElementById(id+"custom_"+i)){
			
			document.getElementById(id+"custom_"+i).value = elmts[i];
			updatecustomform(i,elmts[i]);
		}
	}
	
	//document.getElementById('custom_DakorForm').value = 200;
	//document.getElementById('custom_MainBorderColour').value = '000000';
	//document.getElementById('custom_h2').value = 'Keep Informed';
	//document.getElementById('custom_h2bckgrnd').value = 'FFCC66';
	//document.getElementById('custom_h2txtcolor').value = '366024';
}

function changecalendar(elm){
	
	document.getElementById('eventcalendar').innerHTML = 'Loading...';
	document.getElementById('eventcalendar').innerHTML = "<iframe src=\"http://www.google.com/calendar/embed?src="+county[elm.value]+"%40group.calendar.google.com&ctz=Europe/Dublin\" style=\"border: 0\" width=\"550\" height=\"600\" frameborder=\"0\" scrolling=\"no\"></iframe>";
	showById('eventcalendar');
}


