/* Browser Checking */
//if (parent != self)
//	top.location.href = location.href;

function test_for_javascript(obj){
	obj.javascript.value = "enabled";
}


function openHelpWindow(help_message,width,height,templateStyle){
	help_template = "";

	if(templateStyle == "" || templateStyle == 0){
		help_template += "<html><head><title>CARE Online Help</title>\n";
		help_template += "<link REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"/includes/css/style.css\">\n";
		help_template += "<script LANGUAGE=\"JavaScript\" TYPE=\"text/javascript\" SRC=\"/includes/js/common.js\"></script>\n";
		help_template += "<body BGCOLOR=\"#003366\"><p><br><table CELLSPACING=\"0\" CELLPADDING=\"5\" BORDER=\"0\" WIDTH=\"95%\" HEIGHT=\"90%\" ALIGN=\"center\"><tr><td BGCOLOR=\"#ffffcc\" VALIGN=\"top\">\n";
		help_template += "<b CLASS=\"header\">CARE Online Help</b> [<b><a HREF=\"#\" onClick=\"window.close();\">close</a>]</b>";
		help_template += "<p>" + help_message + "</p>\n";
		help_template += "</td></tr></table></body></html>";
	}
	else if(templateStyle == 2){
		help_template += "<html><head><title>CARE Online Help</title>\n";
		help_template += "<link REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"/includes/css/style.css\">\n";
		help_template += "<script LANGUAGE=\"JavaScript\" TYPE=\"text/javascript\" SRC=\"/includes/js/common.js\"></script>\n";
		help_template += "<body BGCOLOR=\"#003366\" onBlur=\"window.close();\"><p><br><table CELLSPACING=\"0\" CELLPADDING=\"5\" BORDER=\"0\" WIDTH=\"95%\" HEIGHT=\"90%\" ALIGN=\"center\"><tr><td VALIGN=\"top\">\n";
		help_template += "<p>" + help_message + "</p>\n";
		help_template += "</td></tr></table></body></html>";
	}

	HELPWINDOW = window.open("","ratiowindow","width="+width+",height="+height+",scrollbars=yes");
	HELPWINDOW.document.write(help_template);
}

function showPopup(val){
	pfilename = val + ".asp";
	popupWindow = window.open(pfilename,val,'left=100,top=100,screenX=100,screenY=100,width=475,height=575,scrollbars');
}

function addBookmark(){
	var url = 'http://www.careusa.org/';
	var title = 'care usa';
	window.external.AddFavorite(url,title);
}

function chgStatus(val){
	window.status = val;
	return true;
}

/* Thumbnail enlargment function */
var fullsize_path;
function open_fullsize(page_url,img_path,img_caption){
	window_name = "enlg_viewer";
	fullsize_path = img_path;
	if(img_caption == 'undefined' || !img_caption){ fullsize_caption = "contact <a HREF=\"mailto:info@care.org\" onClick=\"window.close();\">care</a> for credit information"; }
	else{ fullsize_caption = img_caption; }
	wref = window.open(page_url,window_name,'width=550,height=650');
	if(!wref.opener){ wref.opener = this.window; }
//	wref.blur();
//	wref.close;
//	wref = window.open(page_url,window_name,'width=550,height=650');
//	if(!wref.opener){ wref.opener = this.window; }
	return false;
}

function submit_form(objform,objbutton){
	if(document.getElementById){
		button_obj = eval("document.getElementById(objbutton.id)");
		button_obj.disabled = true;
		button_obj.value = "disabled";
		objform.submit();
		return true;
	}
	else{
		alert("button is currently disabled.");
		objform.submit();
		return false;
	}
}

function show_wc(country){
	filename = "/careers/wcfiles/show-wc.asp?c=" + country + "&s=true";
	windowname = "wc";
	options = "width=500,height=550,resizable=yes,scrollbars=yes";
	window.open(filename, windowname, options)
}

	function urlencode(input){
		SAFECHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.!~*'()";
		HEX = "0123456789ABCDEF";
		encoded = "";
		for(i=0;(i<input.length);i++){
		ch = input.charAt(i);
			if(ch == " "){ encoded += "+"; }
			else if(SAFECHARS.indexOf(ch) != -1){ encoded += ch;}
			else{
				charCode = ch.charCodeAt(0);
				if(charCode > 255){ encoded += "+"; } //URL encoding only supports 8-bit characters, use a space instead
				else{
					encoded += "%";
					encoded += HEX.charAt((charCode >> 4) & 0xF);
					encoded += HEX.charAt(charCode & 0xF);
				}
			}
		}
		return encoded;
	}

	function browserInfo(){
	  this.name = navigator.appName;
  	this.codename = navigator.appCodeName;
  	this.version = navigator.appVersion.substring(0,4);
  	this.userAgent = navigator.userAgent;
  	this.platform = navigator.platform;
  	this.javaEnabled = navigator.javaEnabled();
  	this.screenWidth = screen.width;
  	this.screenHeight = screen.height;
	}

/*
	function doHitHighlighting(searchTerm){
			alert(document.getElementsByTagName("body").innerHTML.match(searchTerm));
		if(document.getElementById && document.innerHTML && document.getElementsByTagName){
			alert(document.getElementsByTagName("body").innerHTML.match(searchTerm));

		}
	}
*/

