
function foo()
{
}

function get_element(element_id)
{
    if(document.getElementById)
    	return document.getElementById(element_id);
    return false;
}

function is_valid_url(url)
{
	var regexp = /(http):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
	return regexp.test(url);
}

function validate_url(url)
{
	if(is_valid_url(url))
		return true;
	alert('Invalid url!');
	return false;
}

function browser_enables_copy_to_clipboard()
{
    if(window.clipboardData)
		return true;
	return false;
}

function copy_to_clipboard(text_area_element)
{
	if(null == text_area_element)
		return false;
	if(!browser_enables_copy_to_clipboard())
		return false;
		
	/*
	text_range = text_area_element.createTextRange();
	text_range.execCommand('RemoveFormat');
	text_range.execCommand('Copy');
	*/
	window.clipboardData.setData('Text', text_area_element.value);
	return true;
}

var prevent_right_click_messsage = null;
var prevent_right_click_redirect_url = null;
function init_prevent_right_click(message, url)
{
	prevent_right_click_messsage = message;
	prevent_right_click_redirect_url = url;
	
	if(document.layers)
	{
		document.captureEvents(Event.MOUSEDOWN);
	}
}

function prevent_right_click(e)
{
	if(document.all)
	{
		if(event.button == 2) 
		{
			prevent_right_click_action();
			return false;
		}
	}

	if(document.layers || (document.getElementById&&!document.all))
	{
		if(e.which==2 || e.which == 3)
		{
			prevent_right_click_action();
			return false;
		}
	}
}

function prevent_right_click_action()
{
	if(null != prevent_right_click_messsage)
		alert(prevent_right_click_messsage);
	if(null != prevent_right_click_redirect_url)
		window.location.href = prevent_right_click_redirect_url;
}

function textfield_counter(field, cntfield, maxlimit)
{    
    field = get_element(field);
    cntfield = get_element(cntfield);
    
    if(field && cntfield)
    {
        if(field.value.length > maxlimit) // if too long...trim it!
        {
            field.value = field.value.substring(0, maxlimit);
        }
        else // otherwise, update 'characters left' counter
        {
            cntfield.value = maxlimit - field.value.length;
        }
    }
}

function bust_frame_redirect(new_url)
{
    top.location.href = new_url;
}

function onToolbarRequested(value)
{
}

function AC_GenerateobjAlt(objAttrs, params, embedAttrs) 
{ 
    var str = '';
    if (isIE && isWin && !isOpera)
    {
  		str += '<object ';
  		for (var i in objAttrs){
  			str += i + '="' + objAttrs[i] + '" ';
		}
  		for (var i in params) {
  			str += '><param name="' + i + '" value="' + params[i] + '" /> ';
		}
  		str += '></object>';
    } else {
  		str += '<embed ';
  		for (var i in embedAttrs) {
  			str += i + '="' + embedAttrs[i] + '" ';
		}
  		str += '> </embed>';
    }

	var containerId = embedAttrs['containerId'] || params['containerId'];
	if(null != containerId && null != $(containerId))
	{
		$(containerId).innerHTML = str;
	}
	else
	{
		document.write(str);
	}
}

function AC_FL_RunContentAlt()
{
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_GenerateobjAlt(ret.objAttrs, ret.params, ret.embedAttrs);
}

function urchinTracker(url)
{
	// makes our urchinTracker() calls through the site work after the move to ga.js
	try {
		var pageTracker = _gat._getTracker("UA-1048535-1");
		pageTracker._trackPageview(url);
	} catch(err) {
	}
}

/*
// Facebook share button code
function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}
*/

