function switchTab(tabName,countOfTabs,tabActived) 
{		
	for (var i=1;i<=countOfTabs;i++) 
		document.getElementById(tabName + i).style.display = 'none';
	
	var tab = document.getElementById(tabName + tabActived);
	tab.style.display = '';
}

var SnbWindowUtil = {
  getWindowScroll: function(parent) {
    var T, L, W, H;
    parent = parent || document.body;              
    if (parent != document.body) {
      T = parent.scrollTop;
      L = parent.scrollLeft;
      W = parent.scrollWidth;
      H = parent.scrollHeight;
    } 
    else {
      var w = window;
      with (w.document) {
        if (w.document.documentElement && documentElement.scrollTop) {
          T = documentElement.scrollTop;
          L = documentElement.scrollLeft;
        } else if (w.document.body) {
          T = body.scrollTop;
          L = body.scrollLeft;
        }
        if (w.innerWidth) {
          W = w.innerWidth;
          H = w.innerHeight;
        } else if (w.document.documentElement && documentElement.clientWidth) {
          W = documentElement.clientWidth;
          H = documentElement.clientHeight;
        } else {
          W = body.offsetWidth;
          H = body.offsetHeight
        }
      }
    }
    return { top: T, left: L, width: W, height: H };
  }, 
  getPageSize: function(parent){
    parent = parent || document.body;              
    var windowWidth, windowHeight;
    var pageHeight, pageWidth;
    if (parent != document.body) {
      windowWidth = parent.getWidth();
      windowHeight = parent.getHeight();                                
      pageWidth = parent.scrollWidth;
      pageHeight = parent.scrollHeight;                                
    } 
    else {
      var xScroll, yScroll;

      if (window.innerHeight && window.scrollMaxY) {  
        xScroll = document.body.scrollWidth;
        yScroll = window.innerHeight + window.scrollMaxY;
      } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
        xScroll = document.body.scrollWidth;
        yScroll = document.body.scrollHeight;
      } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
        xScroll = document.body.offsetWidth;
        yScroll = document.body.offsetHeight;
      }


      if (self.innerHeight) {  // all except Explorer
        windowWidth = self.innerWidth;
        windowHeight = self.innerHeight;
      } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
        windowWidth = document.documentElement.clientWidth;
        windowHeight = document.documentElement.clientHeight;
      } else if (document.body) { // other Explorers
        windowWidth = document.body.clientWidth;
        windowHeight = document.body.clientHeight;
      }  

      // for small pages with total height less then height of the viewport
      if(yScroll < windowHeight){
        pageHeight = windowHeight;
      } else { 
        pageHeight = yScroll;
      }

      // for small pages with total width less then width of the viewport
      if(xScroll < windowWidth){  
        pageWidth = windowWidth;
      } else {
        pageWidth = xScroll;
      }
    }             
    return {pageWidth: pageWidth ,pageHeight: pageHeight , windowWidth: windowWidth, windowHeight: windowHeight};
  }
}

function SnbLtrim(s){
  return s.replace(/^\s*/,"");
}

function SnbRtrim(s){
   return s.replace(/\s*$/,"");
}

function SnbTrim(s) {
   var temp = s;
   return temp.replace(/^\s+/,'').replace(/\s+$/,'');
}

function srollLoader(){var s=SnbWindowUtil.getWindowScroll();$('slr').style.top=30+s.top+'px';$('slr').style.left=30+s.left+'px';}
function showLoader(text,m)
{
	var s=SnbWindowUtil.getWindowScroll();
	if(typeof text=="undefined" || text==''){
		text = "Loading...";
	}

	var html = '<img src="/images/ajaxload/loading.gif" /><br /><span>'+text+'</span>';
	if(typeof m != "undefined" && m == true)
	{
		html = '<div class="ovr"></div><div class="ldr"><img src="/images/ajaxload/loading.gif" /><br /><span>'+text+'</span></div>';
		$('slr').style.background = "transparent";
		$('slr').style.border = "0px";
	}
	$('slr').innerHTML = html;
	$('slr').style.top=30+s.top+'px';
	$('slr').style.left=30+s.left+'px';
	$('slr').show();
	Event.observe(window,'scroll',srollLoader);
}

function hideLoader()
{
	$('slr').hide();
}

function msgAlert(a)
{
	alert(a);
}
function TextFocus(focus,_text)
{
  var mainsearch = $(focus);
  if (mainsearch.value == _text)
    mainsearch.value = '';
  return true;
}

function TextBlur(blur,_text)
{
   var mainsearch = $(blur);
   if (mainsearch.value.replace(/^\s*/, "").replace(/\s*$/, "") == '')
     mainsearch.value = _text;
   return true;
}

