var cm = 99;
var origClass = 'LinkMenuA';
var sliderIntervalId = 0;
var sliderHeight = 0;
var sliding = false;
var slideSpeed = 10;
var slideId = null;
var slideMax = 75;

function get_AnyElement(elmId){
	var the_Elm = document.getElementById(elmId);
	if (the_Elm == null){
		if (frames.length > 0){
			try{
				the_Elm = frames[0].document.getElementById(elmId);
			}catch(err){
			}
		}
	}
	if (the_Elm == null){
		the_Elm = parent.document.getElementById(elmId);
	}
	return the_Elm;
}

function Slide(chk,id,m){
	if(sliding) return;
	slideId = id;
	sliding = true;
	//if(sliderHeight == 75)
	if (!chk){
		sliderHeight = parseInt(get_AnyElement(slideId).style.height); //slideMax;
		sliderIntervalId = setInterval('SlideUpRun()', 30);
	}else{
		slideMax = m;
		sliderHeight = 30;
		sliderIntervalId = setInterval('SlideDownRun()', 30);
	}
}

function SlideUpRun(){
	slider = get_AnyElement(slideId);
	if(sliderHeight <= 30){
		sliding = false;
		sliderHeight = 30;
		slider.style.height = '30px';
		clearInterval(sliderIntervalId);
		//slider.style.display = 'none';
	}else{
		sliderHeight -= slideSpeed;
		if(sliderHeight <30)
			sliderHeight = 30;
		slider.style.height = sliderHeight + 'px';
	}
}

function SlideDownRun(){
	slider = get_AnyElement(slideId);
	if(sliderHeight>= slideMax){
		sliding = false;
		sliderHeight = slideMax;
		slider.style.height = slideMax+'px';
		clearInterval(sliderIntervalId);
	}else{
		//if (slider.style.display == 'none') slider.style.display = 'block';
		sliderHeight += slideSpeed;
		if(sliderHeight> slideMax)
			sliderHeight = slideMax;
		slider.style.height = sliderHeight + 'px';
	}
}

function handleSlide(o,id,m){
	if (sliding) return;
	o = get_AnyElement(o);
	//alert(o.style.backgroundImage);
	//alert(o.style.backgroundImage.indexOf('close-arrow.gif")'));
	if (o.style.backgroundImage.indexOf('close-arrow.gif') > 0){
		o.style.backgroundImage = 'url(cms/cmsimages/open-arrow.gif)';
		Slide(true,id,m);
	}else{
		o.style.backgroundImage = 'url(cms/cmsimages/close-arrow.gif)';
		Slide(false,id,m);
	}
}

function cformSubmit(){
	s = get_AnyElement('tb_name').value;
	if (s.length <= 0){alert("Name field is required."); return;}
	s = get_AnyElement('tb_company').value;
	if (s.length <= 0){alert("Company field is required."); return;}
	s = get_AnyElement('tb_email').value;
	if (s.length <= 0){alert("EMail Address field is required."); return;}
	s = get_AnyElement('tb_telephone').value;
	if (s.length <= 0){alert("Phone Number field is required."); return;}
	document.forms[0].submit();
}

function signup(){
	s = get_AnyElement('tb_mail').value;
	if (s.length <= 0){alert("EMail Address is required."); return}
	if (!checkMail(s)){alert("EMail Address is invalid."); return}
	document.forms[0].submit();
}

function checkMail(x){
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return filter.test(x);
}

function EvalSound(ssrc){
	StopSound();
	var eSound = get_AnyElement('soundobj');
	alert(eSound);
	eSound.src = ssrc;
	setTimeout("PlaySound()", 2000);
}

function PlaySound(){
	var thissound = get_AnyElement('soundobj');
	thissound.Play();
}

function StopSound(){
	var thissound = get_AnyElement('soundobj');
	thissound.Stop();
}

function DHTMLSound(surl) {
  document.getElementById("soundspan").innerHTML="<embed src='"+surl+"' hidden='true' autostart='true' loop='false'>";
}


function doImageEffect(ei,ni){
	ei.src = 'cms/cmsimages/'+ni;
}
