
$(document).ready(function() {
	// Global
	$('.button, button').button();
    
    $('#href_show_feedback').click(function(){
       pop_feedback(base_url+'feedback');
    });
    
    
    var screen_w = screen.width;
    if (screen_w < 1200) {
        // hide left ad
        $('#abs_left_banner').hide();
    }
});

function is_null(myVar)
{
	if (myVar == "" || myVar == null || myVar.charAt(0) == ' ')
	{
		return true;
	}
	else
	{
		return false;
	}
}

function confirmURL(theURL,thePrompt) {
  if (confirm(thePrompt)) {
    document.location = theURL;
  }
}

function hide_me_and_think(elem)
{
    $('#'+elem).hide('fast');
    $('#'+elem+'_loading').show('fast');
}
function clearText(field)
{
    if (field.defaultValue == field.value) field.value = '';
    else if (field.value == '') field.value = field.defaultValue;
}
function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}
function selectAllText(textbox) {
    $('#'+textbox).focus();
    $('#'+textbox).select();
}
function pop_feedback(url)
{
    var width = 515;
    var height = 650;
    
    var left = (screen.width/2)-(width/2);
    var top = (screen.height/2)-(height/2);
    
    //Open the window.
    var feedback_window = window.open(url,'feedback_popup',"status=no,height="+height+",width="+width+",resizable=no,left=" + left + ",top=" + top + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no");

	if (window.focus) {
	   feedback_window.focus();
    }

}
function isValidEmail(strEmail) 
{
    validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	if (strEmail.search(validRegExp) == -1) {return false;} 
	return true;
}

