//Slideshow

//var mygallery=new fadeSlideShow({
//	wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow
//	dimensions: [900, 200], //width/height of gallery in pixels. Should reflect dimensions of largest image
//	imagearray: [
//		["/uploads/slideshow/roller01.jpg", "", "", ""],
//		["/uploads/slideshow/roller02.jpg", "", "", ""],
//		["/uploads/slideshow/roller03.jpg", "", "", ""],
//		["/uploads/slideshow/roller04.jpg", "", "", ""],
//		["/uploads/slideshow/roller05.jpg", "", "", ""],
//		["/uploads/slideshow/roller06.jpg", "", "", ""],
//		["/uploads/slideshow/roller07.jpg", "", "", ""],
//		["/uploads/slideshow/roller08.jpg", "", "", ""],
//		["/uploads/slideshow/roller09.jpg", "", "", ""],
//		["/uploads/slideshow/roller10.jpg", "", "", ""],
//		["/uploads/slideshow/roller11.jpg", "", "", ""],
//		["/uploads/slideshow/roller12.jpg", "", "", ""],
//		["/uploads/slideshow/roller13.jpg", "", "", ""],
//		["/uploads/slideshow/roller14.jpg", "", "", ""],
//		["/uploads/slideshow/roller15.jpg",  "", "", ""] //<--no trailing comma after very last image element!
//	],
//	displaymode: {type:'auto', pause:5000, cycles:0, wraparound:false},
//	persist: false, //remember last viewed slide and recall within same session?
//	fadeduration: 5000, //transition duration (milliseconds)
//	descreveal: "ondemand",
//	togglerid: ""
//})


//

function check_condition(input_name)
{
	//alert(document.form[1].condition.value);
	if(document.getElementById(input_name).checked == false)
	{
		alert('Please check terms & condition');
		return false;
	}
	else
		return true;
}

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 placeFocus() {
	if (document.forms.length > 0) {
		var field = document.forms[0];
		for (i = 0; i < field.length; i++) {
			if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().				charAt(0) == "s")) {
				document.forms[0].elements[i].focus();
				break;
        	}
     	}
  	}
}

function showImg(imgpath){
	window.document.getElementById("largeimg").src = imgpath;
}

/*Exempel <a href="#" target="pass" onclick="javascript: popup('pass');"> */
function popup(action) {
	window.open('',action,'width=680,height=600,scrollbars=1,top=50,left=50');  
}

function toggleElement(el) {

	if (document.getElementById) {
	  var styl = document.getElementById(el).style.display;
	}
	else if (document.all) {
	  var styl = document.all[el].style.display;
	}
	
	var newStyl = styl == "block" ? "none" : "block";
	
	if (document.getElementById) {
	  document.getElementById(el).style.display = newStyl;
	}
	else if (document.all) {
	  document.all[el].style.display = newStyl;
	}

}


function showAll() {
	var tds = document.getElementsByTagName("div");
	
	for(i = 0; i < tds.length; i++) {
	  tds.item(i).style.display = "block";
	}
}


function countChars(counter, maxChars, el) {
	if (el.value.length > maxChars) {
	  el.value = el.value.substring(0, maxChars);
	}
	counter.innerText = maxChars - el.value.length;

}