function str_replace(olds, news, str)
{
    var len = str.length;
    var newstr = "";
    for(var i = 0; i < len; i ++)
    {
        var strold = str.substr(i, 1);
         newstr += strold.replace(olds, news);
    }
    return newstr;
}
function close(me)
{
$("#" + me).fadeOut('slow');
}
function ask(q)
{
    if(q)
    {
        if(!confirm(q))
        {
            return false;
        }
        else
        {
            return true;
        }
    }
}
function goto(url)
{
    window.open(url, "_self");
}
function gotothispage(url)
{
    window.setTimeout('goto( "' + url + '");', 1000);
}

function ask_b(q, url)
{

    if(ask(q))
    {
        goto(url);
    }
    else
    {
        return false;
    }
}
function gopopup(url)
{
    var width = screen.width - 100;
    var theleft = (screen.width / 2) - (width / 2);
    var theheight = (screen.height / 2) - 350;
    window.open(url, "ads_popup","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=" + width + ",height=600,left=" + theleft + ",top=" + theheight);
    return false;
}


String.prototype.Trim = function()
{
 return this.replace(/(^\s*)|(\s*$)/g, "");
}


 // trim blank space at the beginning
 String.prototype.LTrim = function()
 {
 return this.replace(/(^\s*)/g, "");
 }

 // trim blank space at the end
 String.prototype.RTrim = function()
 {
 return this.replace(/(\s*$)/g, "");
 }

String.prototype.Trimall = function()
{
    return this.replace(/(\s*)/g, "");
}
Array.prototype.find = function(searchStr) {
  var returnArray = false;
  for (i=0; i<this.length; i++) {
    if (typeof(searchStr) == 'function') {
      if (searchStr.test(this[i])) {
        if (!returnArray) { returnArray = [] }
        returnArray.push(i);
      }
    } else {
      if (this[i]===searchStr) {
        if (!returnArray) { returnArray = [] }
        returnArray.push(i);
      }
    }
  }
  return returnArray;
}
function goto_content()
{
    if($(document).height()-$("#content_go").offset().top >= $(window).height()
								 || $("#content_go").offset().top > $(window).height()
								 || $(document).width()-$("#content_go").offset().left >= $(window).width()
								 || $("#content_go").offset().left > $(window).width()){

									$('html, body').animate({
										scrollTop: $("#content_go").offset().top,
										scrollLeft: $("#content_go").offset().left
									}, "slow", null, function(){

									});

                               }
}

$(document).ready(function()
{
    $("body").append('<div style="display: none;"><object height="0" width="0" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"><param value="vid" name="id"/><param value="middle" name="align"/><param value="sameDomain" name="allowScriptAccess"/><param value="true" name="allowFullScreen"/><param value="high" name="quality"/><param value="sound.swf" name="src"/><embed src="sound.swf" height="400" align="middle" width="550" allowscriptaccess="sameDomain" allowfullscreen="true" quality="high" type="application/x-shockwave-flash" id="vid"/></object></div>');
});
