
var letters=' ABCÇDEFGHIJKLMNÑOPQRSTUVWXYZabcçdefghijklmnñopqrstuvwxyzàáÀÁéèÈÉíìÍÌïÏóòÓÒúùÚÙüÜ';
var usernameChars=' ABCÇDEFGHIJKLMNÑOPQRSTUVWXYZabcçdefghijklmnñopqrstuvwxyzàáÀÁéèÈÉíìÍÌïÏóòÓÒúùÚÙüÜ1234567890-';
var numbers='1234567890';
var signs=',.:;@-\'';
var mathsigns='+-=()*/';
var custom='<>#$%&?¿';

function alpha(e,allow) {
	var k;
	k=document.all?parseInt(e.keyCode): parseInt(e.which);
	return (allow.indexOf(String.fromCharCode(k))!=-1);
}
/*****************************************************************
Javascript Popup
*****************************************************************/
function popUp(p_URL, p_Width, p_Height, p_CanScroll, p_Resizable, p_Menubar) {
newWindow = window.open(p_URL, '__', 'toolbar=0,location=0,directories=0,status=0,menubar='+ p_Menubar + ',scrollbars='+ p_CanScroll + ',resizable='+ p_Resizable + ',width=' + p_Width + ',height=' + p_Height );
<!-- <A HREF="javascript:popUp('sample.html', 400, 400)">Open the Popup Window</A>-->
}
/*****************************************************************
Get Flash Object
*****************************************************************/
function getFlashMovie(movieName) {
       if (navigator.appName.indexOf("Microsoft") != -1) {
           return window[movieName];
       } else {
           return document[movieName];
       }
   }
/*****************************************************************

*****************************************************************/
function init(){

}


 function bookmarksite(title, url){
        if (document.all){
        	window.external.AddFavorite(url, title);
 		}else if (window.sidebar){
        	window.sidebar.addPanel(title, url, "");
 		}
    }
	
	function doBookMark(){
		bookmarksite('Harlequin Celebrates/', 'http://www.harlequincelebrates.com/');
	}

/*****************************************************************
							Ajax Object
*****************************************************************/
function createRequestObject() {
	var ro;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
		ro = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		ro = new XMLHttpRequest();
	}
	return ro;
}

var http = createRequestObject();

function sndReq(action, callBack) {
	http.open('get', action);
	http.onreadystatechange = callBack;
	http.send(null);
}
		
function getstates(target) { 
	//Ajax.Request('_PHP/ajax_getStates.php?country_id='+target.value, handleGetStateResponse);
	var action='_PHP/ajax_getStates.php?country_id='+target.value;
	sndReq(action, handleGetStateResponse);
} 

function handleGetStateResponse() { 
	if(http.readyState == 4 || http.readyState == "complete"){
		var response = http.responseText;
		document.getElementById("DIVstate").style.visibility = "visible";
		document.getElementById("statefield").style.visibility = "visible";
		document.getElementById("DIVstate2").innerHTML = response;
	}
}

function highlight(checkbox, origColor) {
   if (document.getElementById) {
      var tr = eval("document.getElementById(\"TR" + checkbox.value + "\")");
   } else {
      return;
   }
   if (tr.style) {
      if (checkbox.checked) {
         tr.style.backgroundColor = "#f90";
      } else {
         tr.style.backgroundColor = origColor;
      }
   }
}

function selectAllBoxes(x) {
	for(var i=0,l=x.form.length; i<l; i++)
	if(x.form[i].type == 'checkbox' && x.form[i].name != 'sAll')
	x.form[i].checked=x.form[i].checked?false:true
}

// Example:
// randomImage(['0.gif',50,50,'1.gif',25,25,'2.gif',50,25]); 

// * Dependencies * 
// this function requires the following snippet:
// JavaScript/Randomizers/randomNumber

function randomImage(imgArr)
{
  var imgSrc, imgW, imgH, r;
  r = randomNumber(imgArr.length / 3)-1;
  
  imgSrc = imgArr[r * 3];
  imgW = imgArr[(r * 3)+1];
  imgH = imgArr[(r * 3)+2];

  document.write('<IMG SRC='+imgSrc+' WIDTH='+imgW+' HEIGHT='+imgH+'>');
}


function printPage() { print(document); }

function platformDetect()
{
  if(navigator.appVersion.indexOf("Win") != -1)
  {
    alert("Windows");
  }
  else if(navigator.appVersion.indexOf("Mac") != -1)
  {
    alert("Macintosh");
  }
  else alert("Other");
}

// Example:
// var b = new BrowserInfo();
// alert(b.version); 
function BrowserInfo()
{
  this.name = navigator.appName;
  this.codename = navigator.appCodeName;
  this.version = navigator.appVersion.substring(0,4);
  this.platform = navigator.platform;
  this.javaEnabled = navigator.javaEnabled();
  this.screenWidth = screen.width;
  this.screenHeight = screen.height;
}



//////tooltips

ShowTooltip = function(e)
{
	var text = $(this).next('.show-tooltip-text');
	if (text.attr('class') != 'show-tooltip-text')
		return false;

	text.fadeIn()
		.css('top', e.pageY)
		.css('left', e.pageX+10);

	return false;
}
HideTooltip = function(e)
{
	var text = $(this).next('.show-tooltip-text');
	if (text.attr('class') != 'show-tooltip-text')
		return false;

	text.fadeOut();
}

SetupTooltips = function()
{
	$('.show-tooltip')
		.each(function(){
			$(this)
				.after($('<span/>')
					.attr('class', 'show-tooltip-text')
					.html($(this).attr('title')))
				.attr('title', '');
		})
		.hover(ShowTooltip, HideTooltip);
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
}
function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}
