function changeSize(p,el) {
	var fs = $('#'+el).css('font-size').replace('px','');
	if (fs==955) {	//IE7 bug (?)
		fs = fs - 944;
	}
	var nfs = parseFloat(fs);
	if (p == 'grow') {
		nfs++;
	}
	else {
		nfs--;
	}
	if ((nfs > 8)&&(nfs < 16)) {
		$('#'+el).css('font-size',nfs+'px');
	}
}

function printSelection(node){
	var content=node.innerHTML;
	var pwin=window.open('','print_content','width=500,height=500');
	pwin.document.open();
	pwin.document.write('<html><head><style>body{ font:normal 11px Trebuchet MS;}h1{ font:normal 22px Trebuchet MS;}h2{ font:bold 18px Trebuchet MS;}h3{ font:bold 14px Trebuchet MS;}h4{ font:bold 12px Trebuchet MS;} p{ font:normal 11px Trebuchet MS;} img { float:left; margin-right:20px;}</style></head><body onload="window.print()">'+content+'</body></html>');
	pwin.document.close();
	pwin.print();
	setTimeout(function(){pwin.close();},1000);
}

function addBookmark(title, url, obj){
	if (!url) url = location.href;
	if (!title) title = document.title;
	if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) 
		window.sidebar.addPanel (title, url, "");//Gecko
	else if (document.all) 
		window.external.AddFavorite(url, title); //IE4+
	else if (window.opera && document.createElement) {
		obj.setAttribute('rel','sidebar');
		obj.setAttribute('href',url);
		obj.setAttribute('title',title);
	}
	else {
		alert("Your browser does not support bookmarks.	Press ctrl+D (ctrl+T for old Opera);");
		return false; //IF Opera 6
	}
	return true;
}

function changeSize(p,el) {
	var fs = $('#'+el).css('font-size').replace('px','');
	if (fs==955) {	//IE7 bug (?)
		fs = fs - 944;
	}
	var nfs = parseFloat(fs);
	if (p == 'grow') {
		nfs++;
	}
	else {
		nfs--;
	}
	if ((nfs > 8)&&(nfs < 16)) {
		$('#'+el).css('font-size',nfs+'px');
	}
}

function printSelection(node){
	var content=node.innerHTML;
	var pwin=window.open('','print_content','width=500,height=500');
	pwin.document.open();
	pwin.document.write('<html><head><style>body{ font:normal 11px Trebuchet MS;}h1{ font:normal 22px Trebuchet MS;}h2{ font:bold 18px Trebuchet MS;}h3{ font:bold 14px Trebuchet MS;}h4{ font:bold 12px Trebuchet MS;} p{ font:normal 11px Trebuchet MS;} img { float:left; margin-right:20px;}</style></head><body onload="window.print()">'+content+'</body></html>');
	pwin.document.close();
	pwin.print();
	setTimeout(function(){pwin.close();},1000);
}

function addBookmark(title, url, obj){
	if (!url) url = location.href;
	if (!title) title = document.title;
	if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) 
		window.sidebar.addPanel (title, url, "");//Gecko
	else if (document.all) 
		window.external.AddFavorite(url, title); //IE4+
	else if (window.opera && document.createElement) {
		obj.setAttribute('rel','sidebar');
		obj.setAttribute('href',url);
		obj.setAttribute('title',title);
	}
	else {
		alert("Your browser does not support bookmarks.	Press ctrl+D (ctrl+T for old Opera);");
		return false; //IF Opera 6
	}
	return true;
}

// Accepts a url and a callback function to run.
function requestCrossDomain( site, callback ) {

	// If no url was passed, exit.
	if ( !site ) {
		alert('No site was passed.');
		return false;
	}

	// Take the provided url, and add it to a YQL query. Make sure you encode it!
	var yql = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="' + site + '"') + '&format=xml&callback=?';

	// Request that YSQL string, and run a callback function.
	// Pass a defined function to prevent cache-busting.
	jQuery.getJSON( yql, cbFunc );

	function cbFunc(data) {
	// If we have something to work with...
	if ( data.results[0] ) {
		// Strip out all script tags, for security reasons.
		// BE VERY CAREFUL. This helps, but we should do more.
		data = data.results[0].replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '');

		// If the user passed a callback, and it
		// is a function, call it, and send through the data var.
		if ( typeof callback === 'function') {
			callback(data);
		}
	}
	// Else, Maybe we requested a site that doesn't exist, and nothing returned.
	else throw new Error('Nothing returned from getJSON.');
	}
}

