// JavaScript for PeopleSearchNow.com

// ultimate get elements by class function
// credits: http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/
function getElementsByClass(oElm, strTagName, oClassNames){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	var arrRegExpClassNames = new Array();
	if(typeof oClassNames == "object"){
		for(var i=0; i<oClassNames.length; i++){
			arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)"));
		}
	}
	else{
		arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames.replace(/\-/g, "\\-") + "(\\s|$)"));
	}
	var oElement;
	var bMatchesAll;
	for(var j=0; j<arrElements.length; j++){
		oElement = arrElements[j];
		bMatchesAll = true;
		for(var k=0; k<arrRegExpClassNames.length; k++){
			if(!arrRegExpClassNames[k].test(oElement.className)){
				bMatchesAll = false;
				break;
			}
		}
		if(bMatchesAll){
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}

// gives Array support for the push method to IE5
if(typeof Array.prototype.push != "function"){
	Array.prototype.push = ArrayPush;
	function ArrayPush(value){
		this[this.length] = value;
	}
}

// basic popup window
// <a href="javascript:OpenWin('/path/to/file.htm',400,225);">
function OpenWin(url, w, h, x) {
var intLeft = null;
var intTop  = null;
    
  switch(x) {
    case "topleft":
      intLeft = 0;
      intTop = 0;
    break;
    case "topright":
      intLeft = screen.availWidth - w;
      intTop = 0;
    break;
    case "bottomright":
      intLeft = screen.availWidth - w;
      intTop = screen.availHeight - h;
    break;
    case "bottomleft":
      intLeft = 0;
      intTop = screen.availHeight - h;
    break;
    default:
	  intLeft = 10;
	  intTop = 10;	
	  try
	  {
		var intLeft = (screen.availWidth / 2) - (w / 2 );
		var intTop = (screen.availHeight / 2) - (h / 2 );
	  }
	  catch(e){}
    break;
  }
	window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,top=' + intTop + ',left=' + intLeft + ',scrollbars=1,resizable=0,width=' + w + ',height=' + h);
}


function popUpHelp(product,combined) {
	var w = 810; //screen.width - 200
	var h = 610; //screen.height - 200;
	var iLeft = 0;
	var iTop = 0;

	var settings = "toolbar=no,scrollbars=yes,resizable=yes,width=" + w + ",height=" + h + ",top=" + iTop + ",left=" + iLeft;

	var url = "/producthelp.asp?product=" + product + "&combined=" + combined + "#sample";
	window.open(url,'sample',settings);
	return false;
}