function Trim(TRIM_VALUE)
{
   if(TRIM_VALUE.length < 1)
   {
      return"";
   }

   TRIM_VALUE = RTrim(TRIM_VALUE);
   TRIM_VALUE = LTrim(TRIM_VALUE);
   if(TRIM_VALUE=="")
   {
     return "";
   }
   else
   {
      return TRIM_VALUE;
   }
} //End Function

function RTrim(VALUE){
var w_space = String.fromCharCode(32);
var v_length = VALUE.length;
var strTemp = "";
if(v_length < 0){
return"";
}
var iTemp = v_length -1;

while(iTemp > -1){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(0,iTemp +1);
break;
}
iTemp = iTemp-1;

} //End While
return strTemp;

} //End Function

function LTrim(VALUE){
var w_space = String.fromCharCode(32);
if(v_length < 1){
return"";
}
var v_length = VALUE.length;
var strTemp = "";

var iTemp = 0;

while(iTemp < v_length){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} //End While
return strTemp;
} //End Function






//Specify the marquee's width (in pixels)
var marqueewidth="100%"

//Specify the marquee's height
//var marqueeheight="160px"
var marqueeheight="200px"

//Specify the marquee's marquee speed (larger is faster 1-10)
var marqueespeed=1

//Pause marquee onMousever (0=no. 1=yes)?
var pauseit=1

marqueespeed=(document.all)? marqueespeed : Math.max(1, marqueespeed-1) //slow speed down by 1 for NS
var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var iedom=document.all||document.getElementById
var actualheight=''
var cross_marquee, ns_marquee

function populate()
{
      cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
      cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
      cross_marquee.innerHTML=marqueecontent
      actualheight=cross_marquee.offsetHeight

   lefttime=setInterval("scrollmarquee()",35)
}


function scrollmarquee()
{

  if (iedom)
  {
    if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
    cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
    else
    cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
  }
}

/*==================================
	REAL-POPUPS FUNCTIONS
====================================*/
function popupVideo(url)
{
		var width=685;
		var height=620;

		var winl = 10;
		var wint = 10;
		winprops = "height="+height+",width="+width+",top="+wint+",left="+winl+",scrollbars=0,resizable=1,status=0,toolbar=0,menubar=0";

		winVplayer = window.open(url, 'video', winprops)
		if (parseInt(navigator.appVersion) >= 4)
		{
		 winVplayer.window.focus();
		}
}
function popupCalendar(url,field_id)
{
  var winl = (screen.width - 222) / 2;
  var wint = (screen.height - 200) / 2;
  winprops = "height=200,width=270,top="+wint+",left="+winl+",scrollbars=0,resizable=0,status=0,toolbar=0,menubar=0";
  mypage=url+"?ind="+field_id;
  win = window.open(mypage, 'calendar', winprops)
    if (parseInt(navigator.appVersion) >= 4)
      {
        win.window.focus();
      }
}

function popup_eventPicture(u,w,h)
{
  if(w >= h)
  {
    var height=543;
    var width=360;
  }
  else
  {
    var height=655;
    var width=448;
  }
  //var winl = (screen.width - 222) / 2;
  //var wint = (screen.height - 200) / 4;
  height=583;
  width=469;
  var winl = 10;
  var wint = 10;
  winprops = "height="+height+",width="+width+",top="+wint+",left="+winl+",scrollbars=0,resizable=0,status=0,toolbar=0,menubar=0";
  winPic = window.open(u, 'showPic', winprops)
  if (parseInt(navigator.appVersion) >= 4)
  {
    winPic.window.focus();
  }
}

function showCorpPopUp(sId)
{
    var width=795;
    var height=650;

  var winl = 10;
  var wint = 10;
  winprops = "height="+height+",width="+width+",top="+wint+",left="+winl+",scrollbars=1,resizable=1,status=0,toolbar=0,menubar=0";

  winCorp = window.open("corporative/show.single.php?eventId="+sId, 'showCorps', winprops)
  if (parseInt(navigator.appVersion) >= 4)
  {
    winCorp.window.focus();
  }
}

function tuyoPostBoardPopUp(abUrl)
{
  var width=768;
  var height=670;

  var winl = 10;
  var wint = 10;
  winprops = "height="+height+",width="+width+",top="+wint+",left="+winl+",scrollbars=0,resizable=1,status=0,toolbar=0,menubar=0";

  winCorp = window.open(abUrl, 'tuyoAnswerBoard', winprops)
  if (parseInt(navigator.appVersion) >= 4)
  {
    winCorp.window.focus();
  }
}

function showHrspPopUp(u)
{
  var height=200;
  var width=505;

  var winl = (screen.width - 222) / 2;
  var wint = (screen.height - 200) / 2;
  winprops = "height="+height+",width="+width+",top="+wint+",left="+winl+",scrollbars=0,resizable=0,status=0,toolbar=0,menub\ar=0";
  winHrspEmail = window.open(u, 'showHrspEmail', winprops)
  if (parseInt(navigator.appVersion) >= 4)
  {
    winHrspEmail.window.focus();
  }
}

function showNmrPopUp(u)
{
  var height=260;
  var width=505;

  var winl = (screen.width - 222) / 2;
  var wint = (screen.height - 200) / 2;
  winprops = "height="+height+",width="+width+",top="+wint+",left="+winl+",scrollbars=1,resizable=1,status=0,toolbar=0,menubar=0";
  winNmr = window.open(u, 'showNmr', winprops)
  if (parseInt(navigator.appVersion) >= 4)
  {
    winNmr.window.focus();
  }
}

function showSurveyPopUp(sId)
{
    var width=448;
    var height=543;

  var winl = 10;
  var wint = 10;
  winprops = "height="+height+",width="+width+",top="+wint+",left="+winl+",scrollbars=0,resizable=0,status=0,toolbar=0,menubar=0";

  winSurvey = window.open("survey/survey_popup.php?sId="+sId, 'showSurvey', winprops)
  if (parseInt(navigator.appVersion) >= 4)
  {
    winSurvey.window.focus();
  }
}

function popUp(uri,popName,width,height)
{	
	if(!arguments[4]) {winX = 430;}
	else {winX = arguments[4];} 
	if(!arguments[5]) {winY = 272;}
	else {winY = arguments[5];}
	winprops = "height="+height+",width="+width+",top="+winY+",left="+winX+",scrollbars=0,resizable=0,status=0,toolbar=0,menubar=0";
	
	ttt = window.open(uri,'fuckIEveryHard', winprops);
  if (parseInt(navigator.appVersion) >= 4)
  {
    ttt.window.focus();
  }	
}
/*========================================*/

function changeClassByTag(tagType, idPrefix, newClass)
{
        var td = document.getElementsByTagName(tagType);
	for(i=0; i< td.length; i++)
	{
		if(td[i].id && td[i].id.indexOf(idPrefix) === 0)
		{
			document.getElementById(td[i].id).className=newClass;
		}
	}
}

/*========================================*/
function setActiveStyleSheet(title)
{
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++)
   {
     if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title"))
     {
       a.disabled = true;
       if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
}
/*========================================*/
function setHeader(headerImage)
{
	document.getElementById('header-image').src=headerImage;
}

