function showItemInfo(strHost, strPartNo, itemID) {
	strRetURL = strHost + "/ItemImg/ItemPopup.asp?pno=" + escape(strPartNo);
	sealWin=window.open(strRetURL,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=550,height=600,left=0,top=0');
	self.name = itemID;
}

function hxj_FindObject(v) {
	var obj = null;
	
    if (document.getElementById) {
    	obj = document.getElementById(v);
    }	    
    else if (document.all) {
    	obj = document.all[v];
    }
	
	return obj;
}

function hxj_GetCheckCount(objForm) {
	var nCount = 0;

	for (var i = 0; i < objForm.elements.length; i++) {
		if (objForm.elements[i].checked == true) {
			nCount++;
		}
   	}

	return nCount;
}

function getCheckObject(objForm) {
	var inputs = objForm.getElementsByTagName("input");

	for (var i = 0; i < inputs.length; i++) {
		if (inputs[i].checked == true) {
			return inputs[i];
		}
   	}

	return null;
}

// Only allows certain keys to be used in the date field
function hxj_EnterDigits(e) {
	if (!e) e = window.event;
	var KeyCode = (e.keyCode) ? e.keyCode : e.which;
	
	var numcheck = /\d/;	
	var isNumber = numcheck.test(String.fromCharCode(KeyCode));
	if (!isNumber) {
	    switch (KeyCode) {
	    	case 13:	// Enter
	    	case 8:     // Back Space
	    	case 9:     // tab 
		    case 46:    // Del
			case 35:    // end
			case 36:    // home
			case 37:    // <-    
			case 39:    // ->
			case 96:	// 96 to 105 are numlock keypad
			case 97:
			case 98:
			case 99:
			case 100:
			case 101:
			case 102:
			case 103:
			case 104:
			case 105:
			    return true;
		}
			
		return false;
	}
	    	
	return true;
}

function hxj_EnterCurrency(e) {
	if (!e) e = window.event;
	var KeyCode = (e.keyCode) ? e.keyCode : e.which;
	
	var numcheck = /\d/;	
	var isNumber = numcheck.test(String.fromCharCode(KeyCode));
	if (!isNumber) {
	    switch (KeyCode) {
	    	case 13:	// Enter
	    	case 8:     // Back Space
		    case 46:    // Del
		    case 190:   // .(dot)
			case 35:    // end
			case 36:    // home
			case 37:    // <-    
			case 39:    // ->
			case 96:	// 96 to 105 are numlock keypad
			case 97:
			case 98:
			case 99:
			case 100:
			case 101:
			case 102:
			case 103:
			case 104:
			case 105:
			    return true;
		}
			
		return false;
	}
	    	
	return true;
}

function hxj_OpenWindow(url, name, width, height, isresize) {
	if (hxj_IsNull(name))
		name = "hxjwin";
	if (hxj_IsNull(width))
		width = 600;
	if (hxj_IsNull(height))
		height = 440;
	if (hxj_IsNull(isresize))
		isresize=1;
		
	try {
		openwin.close();
	} catch(e) {
	}
	
	openwin = window.open(url, name, 'location=0,status=0,scrollbars='+isresize+',resizable='+isresize+',width='+width+',height='+height);
	openwin.moveTo(screen.width/2-width/2, screen.height/2-height/2);
	openwin.focus();	
}

function doFixPng(imgobj) {
	if (imgobj.runtimeStyle != null 
			&& imgobj.runtimeStyle.filter != null) {
		var original = imgobj.src;
		
		imgobj.style.visibility = 'hidden';

		var preload = new Image();
		preload.onload = function(){
			imgobj.style.height = imgobj.style.height ? imgobj.style.height : this.height;
			imgobj.style.width = imgobj.style.width ? imgobj.style.width : this.width;
			imgobj.onload = function() {}
			
			var srcHost = (("https:" == document.location.protocol) ? "https://" : "http://");
			
			imgobj.src = srcHost + "www.campushp.com/public/img/blank.gif";
			imgobj.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod='crop', src='" + original + "')";		
			imgobj.style.visibility = 'visible'; 
		}
		preload.src = imgobj.src;
	}
}

function formatNumber(num) {
	var str = String(num).split(".");
	
	var re = /(-?[0-9]+)([0-9]{3})/;
	while (re.test(str[0])) {
	    str[0] = str[0].replace(re, "$1,$2");
	}
	
	if (str.length == 2) {
		if (str[1].length >= 3) {
			var flt = parseInt(String(str[1]).substr(0,3)) / 10;
			str = str[0] + "." + Math.ceil(flt);		
		}
		else if (str[1].length == 2) {
			str = str[0] + "." + str[1];
		}
		else {
			str = str[0] + "." + str[1] + "0";
		}			
	}
		
	return str;
}

function $F(id) {
	if(document.getElementById)return document.getElementById(id);
    if(document.all)return document.all[id];
}
