function printfire() {
	if (window.opera) {
		opera.postError(arguments);
		return;
	}
    if (document.createEvent) {
        printfire.args = arguments;
        var ev = document.createEvent("Events");
        ev.initEvent("printfire", false, true);
        dispatchEvent(ev);
    }
}

function camelCaps(str) {
	var tempArray = str.split('-');
	// Make the first character of each word upper- or lowercase
	for (var i = 1; i < tempArray.length; i++) {
		tempArray[i] = tempArray[i].charAt(0).toUpperCase() + tempArray[i].substring(1);
	}
	return tempArray.join();
}

function getStyle(el,property) {
	if (el.currentStyle) {
		return el.currentStyle[camelCaps(property)];
	} else if (document.defaultView.getComputedStyle) {
		return document.defaultView.getComputedStyle(el,null).getPropertyValue(property);
	}
}

function showFlash(strFile) {
	var myStr = unescape(strFile);
	var output = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
	+ 'width="197" '
	+ 'height="209" '
	+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
	+ '<param name="movie" value="images/web1.swf?'+myStr+'">'
	+ '<param name="play" value="true">'
	+ '<param name="quality" value="high">'
	+ '<embed src="images/web1.swf?' + myStr + '" '
	+ 'width="197" '
	+ 'height="209" '
	+ 'quality="high" '
	+ 'type="application/x-shockwave-flash" '
	+ 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
	+ '</embed>'
	+ '</object>';
	document.write(output);
}

function showFade(strFile) {
	var myStr = unescape(strFile);
	var output = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
	+ 'width="197" '
	+ 'height="209" '
	+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
	+ '<param name="movie" value="images/fade.swf?'+myStr+'">'
	+ '<param name="play" value="true">'
	+ '<param name="quality" value="high">'
	+ '<embed src="images/fade.swf?' + myStr + '" '
	+ 'width="197" '
	+ 'height="209" '
	+ 'quality="high" '
	+ 'type="application/x-shockwave-flash" '
	+ 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
	+ '</embed>'
	+ '</object>';
	document.write(output);
}

function emailCheck (emailad)
{
  var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
  var check=/@[\w\-]+\./;
  var checkend=/\.[a-zA-Z]{2,6}$/;
  if(((emailad.search(exclude) != -1)||(emailad.search(check)) == -1)||(emailad.search(checkend) == -1)){
	alert("Please ensure that you enter a valid email address");
	return false;
  }
  else {
	return true;
  }
}

function checkrequired(which)
{
	var Check0 = true;
	var Check1 = true;
	var pass=true;
	if (document.images)
	{
		for (i=0;i<which.length;i++)
		{
			var tempobj=which.elements[i];
			if (tempobj.name.substring(0,8)=="required")
			{
				if (((tempobj.type=="text"||tempobj.type=="textarea")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.options[tempobj.selectedIndex].value=='Please Choose'))
				{
					pass=false;
					break;
         	}
      	}
   	}
	}
	if (!pass)
	{
		alert("Please make sure the field "+tempobj.name.substring(8)+" has been completed.");
		return false;
	}
	else
	{
		return emailCheck(which.requiredemail.value);
	}
}

var htick = null;

function addhomescroller() {
	if (document.getElementById) {
		var el = document.getElementById('homestickerscroll');
		if (el) { 
			el.innerHTML = '<span id="hstext1" style="position:absolute;top:0px;white-space:nowrap;" class="hstext">' + homescrolltext + '</span><span id="hstext2" style="position:absolute;top:0px;white-space:nowrap;" class="hstext">' + homescrolltext + '</span>';
			var width = parseInt(getStyle(el,'width'));
			var t1 = document.getElementById('hstext1');
			var t2 = document.getElementById('hstext2');
			//alert(el.innerHTML);
			t1.style.left = width + 8 + "px";
			//alert(t1.offsetWidth);
			var i = (width + 8 + parseInt(t1.offsetWidth)) + 'px';
			//alert(t1.offsetWidth);
			t2.style.left = (width + 8 + parseInt(t1.offsetWidth)) + 'px';
		}	
		if (htick == null) htick = setInterval(function() { movehomescroller() }, 15);
	}
}

function movehomescroller() {
	var el = document.getElementById('homestickerscroll');
	var t1 = document.getElementById('hstext1');
	var t2 = document.getElementById('hstext2');
	if (el && t1 && t2) {
		var w1 = 0 - parseInt(t1.offsetWidth);
		var w2 = 0 - parseInt(t2.offsetWidth);
		var l1 = parseInt(t1.style.left);
		var l2 = parseInt(t2.style.left);
		//alert (w1 + ' ' + w2 + ' ' + l1 + ' ' +l2);
		if (l1 > w1 && l2 > w2) {
			t1.style.left = (l1 - 1) + 'px';
			t2.style.left = (l2 - 1) + 'px';
		} 
		else {
			if (l1 <= w1)
				t1.style.left = (l2 - w2) + 'px';
			if (l2 <= w2)
				t2.style.left = (l1 - l2) + 'px';
		}
	}
}
