
	var winW = 630, winH = 460;
	var add_y = (/msie/i.test(navigator.userAgent)) ? -4 : 0;
	var add_x = (/msie/i.test(navigator.userAgent)) ? +12 : 0;
	var extra_y = 0;

	function findWH() {
		if (parseInt(navigator.appVersion)>3) {
			if (navigator.appName == "Netscape") {
				winW = window.innerWidth-16;
				winH = window.innerHeight-16;
			}
			if (navigator.appName.indexOf("Microsoft")!=-1) {
				winW = document.body.offsetWidth-20;
				winH = document.body.offsetHeight-20;
			}
		}
		if (winW < 768) { winW = 760; }
	}

	function selectMoveType(id, str)
	{
		ypSlideOutMenu.hide("menuSizes");
		if (document.getElementById)
		{
			$("move_size").value = str;
			$("size").value = id;
		} else {
			document.all["move_size"].value = str;
			document.all["size"].value = id;
		}
	}

	function checkQuote(el)
	{
		var q = el.selectedIndex;
		var div = $('divRowToState');
		div.style.display = (q == 4 ? 'none' : 'block');
		div.style.visibility = (q == 4 ? 'hidden' : 'visible');
		$('to_state').setAttribute( 'required', (q == 4 ? '' : 'true') );
		if (el.value)
			$('pageTitle').src = '/i/titles/quote_type_'+el.value+'.gif'
		else
			$('pageTitle').src = '/i/titles/starthere.gif'
	}

	function loadIframe(iframeName, url) {
		if (window.frames[iframeName]) {
			window.frames[iframeName].location = url;   
			return false;
		}
			else return true;
	}

	function $() {
		var elements = [];
		for (var i = 0; i < arguments.length; i++) {
			var element = arguments[i];
			if (typeof element == 'string')
				element = document.getElementById(element);
			if (arguments.length == 1) return element;
			elements.push(element);
		}
		return elements;
	}

	function addClassName(el, sClassName) {
		var s = el.className;
		var p = s.split(" ");
		var l = p.length;
		for (var i = 0; i < l; i++) {
			if (p[i] == sClassName)
			{
				return;
			}
		}
		p[p.length] = sClassName;
		el.className = p.join(" ");

	}

	function removeClassName(el, sClassName) {
		var s = el.className;
		var p = s.split(" ");
		var np = [];
		var l = p.length;
		var j = 0;
		for (var i = 0; i < l; i++) {
			if (p[i] != sClassName)
			{
				np[j++] = p[i];
			}
		}
		el.className = np.join(" ");
	}

	function newImage(strFilename) {
		strFilename = strImagePath + strFilename;
		if (document.images) {
			objTempImage = new Image();
			objTempImage.src = strFilename;
			return objTempImage;
		}
	}

	function changeImage(strLocation, strImage) {
		document.images[strLocation].src = eval(strImage + ".src");
	}

	var newWin = null; 
	
	function launchNewWin(URL, windowName, windowWidth, windowHeight, scrollbars)
	{
		var xposition = 400; 
		var yposition = 300;
		
		if ((parseInt(navigator.appVersion) >= 4 )) {
			xposition = (screen.width - windowWidth) / 2;
			yposition = (screen.height - windowHeight) / 2;
		}
		
		if (!scrollbars) var scrollbars = 0;
		
		var args = "width=" + windowWidth + ","
				+ "height=" + windowHeight + ","
				+ "location=0,"
				+ "menubar=0,"
				+ "scrollbars=" + scrollbars + ","
				+ "status=0,"
				+ "titlebar=0,"
				+ "hotkeys=0,"
				+ "screenx=" + xposition + ","  // NN Only
				+ "screeny=" + yposition + ","  // NN Only
				+ "left=" + xposition + ","     // IE Only
				+ "top=" + yposition;           // IE Only
			
		if (newWin != null && !newWin.closed) {
			newWin.close();
		}
		newWin = window.open(URL, windowName, args);
		
		newWin.focus();
	}

	function maxLength(el, elCount, max)
	{
		if (el != null && el.value != null)
		{
			if (el.value.length > max)
			{
				alert('Your comment may not exceed ' +  max + ' characters in length.');
				el.value = el.value.substring(0, max);
			}
			else if (elCount != null)
			{
				elCount.value = max - el.value.length;
			}
		}
	}	

	function addEvent( obj, type, fn )
	{
		if (obj.addEventListener)
		{
			obj.addEventListener( type, fn, false );
		}	
		else if (obj.attachEvent)
		{
			obj["e"+type+fn] = fn;
			obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
			obj.attachEvent( "on"+type, obj[type+fn] );
		}
		
	
	}
