/***************************************/





function redirectTo(targeturl)

{

	//alert(targeturl);

	//window.open(targeturl);

	window.open(targeturl,"pop","width=1024,height=500%,status=yes,resizable=yes,scrollbars=yes");

}









/************************************************/

//js for accordion









/*************************************************/





/***********************************************/

//Validation for search



function ValidateSearch()

	{

		

		//var temp=trim(document.form_search.textfield.value);

		if(document.getElementById('Search').value=="" || document.getElementById('Search').value=="Search" || document.getElementById('Search').value=="Search MoSys.com....")

		{			 

			//alert("Please enter text for searching");

			

			//document.form_search.Search.focus();

			//return false;

		}

		else

		{

			//alert("Test");

			document.form_search.action="search.php?Search=";

			document.form_search.submit();

		}

	}

	

	function ClearTextBox()

	{

		document.form_search.Search.value="";

	}



/************************************************/







/************************************************************/

//home page news scroll











/*****************************************************************/



function Redirect()

    { 

       if (document.aspnetForm.idSearchString.value != ''){

          document.location = "#" + document.aspnetForm.idSearchString.value;

           return false;

        }

    }

       function RedirectKeys(event)

    { 

       

        if (event.keyCode==13)

        {

          

           if (document.aspnetForm.idSearchString.value != ''){

              document.location = "#" + document.aspnetForm.idSearchString.value;

               return false;

            }

        }

    }

var tablink_idname = new Array("tablink")

var tabcontent_idname = new Array("tabcontent") 

var tabcount = new Array("4")

var loadtabs = new Array("1")  

var autochangemenu = 0;

var changespeed = 3;

var stoponhover = 0;

function easytabs(menunr, active) 

{if (menunr == autochangemenu){currenttab=active;}

 if (active == 2)

     {

         		document.getElementById("img2").src = "img/2-on.jpg";

                document.getElementById("img1").src = "img/1-off.jpg";

				document.getElementById("img3").src = "img/3-off.jpg";

		 		document.getElementById("img4").src = "img/4-off.jpg";				



     }

      if (active == 1)

     {

         document.getElementById("img1").src = "img/1-on.jpg";        

		 document.getElementById("img2").src = "img/2-off.jpg";

		 document.getElementById("img3").src = "img/3-off.jpg";

		 document.getElementById("img4").src = "img/4-off.jpg";		 





     }



  if (active == 3)

     {

         document.getElementById("img3").src = "img/3-on.jpg";

		 document.getElementById("img4").src = "img/4-off.jpg";		 

		 document.getElementById("img2").src = "img/2-off.jpg";

         document.getElementById("img1").src = "img/1-off.jpg";



     }

  if (active == 4)

     {

	 		document.getElementById("img4").src = "img/4-on.jpg";

         	document.getElementById("img3").src = "img/3-off.jpg";

		 	document.getElementById("img2").src = "img/2-off.jpg";

         	document.getElementById("img1").src = "img/1-off.jpg";



     }	 

if ((menunr == autochangemenu)&&(stoponhover==1)) {stop_autochange()} else if ((menunr == autochangemenu)&&(stoponhover==0))  {counter=0;}menunr = menunr-1;for (i=1; i <= tabcount[menunr]; i++){document.getElementById(tablink_idname[menunr]+i).className='tab'+i;document.getElementById(tabcontent_idname[menunr]+i).style.display = 'none';}document.getElementById(tablink_idname[menunr]+active).className='tab'+active+' tabactive';document.getElementById(tabcontent_idname[menunr]+active).style.display = 'block';}var timer; counter=0; var totaltabs=tabcount[autochangemenu-1];var currenttab=loadtabs[autochangemenu-1];function start_autochange(){counter=counter+1;timer=setTimeout("start_autochange()",1000);if (counter == changespeed+1) {currenttab++;if (currenttab>totaltabs) {currenttab=1}easytabs(autochangemenu,currenttab);restart_autochange();}}function restart_autochange(){clearTimeout(timer);counter=0;start_autochange();}function stop_autochange(){clearTimeout(timer);counter=0;}



function inittab(){

var menucount=loadtabs.length; var a = 0; var b = 1; do {easytabs(b, loadtabs[a]);  a++; b++;}while (b<=menucount);

if (autochangemenu!=0){start_autochange();}

}





/*******************************************************************************************/





/***********************************************



* Pausing up-down scroller- © Dynamic Drive (www.dynamicdrive.com)



* This notice MUST stay intact for legal use



* Visit http://www.dynamicdrive.com/ for this script and 100s more.



***********************************************/



function pausescroller(content, divId, divClass, delay){



this.content=content //message array content



this.tickerid=divId //ID of ticker div to display information



this.delay=3000 //Delay between msg change, in miliseconds.



this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)



this.hiddendivpointer=1 //index of message array for hidden div



document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden;width:280px;height:90px;line-height:20px;"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')



var scrollerinstance=this



if (window.addEventListener) //run onload in DOM2 browsers



window.addEventListener("load", function(){scrollerinstance.initialize()}, false)



else if (window.attachEvent) //run onload in IE5.5+



window.attachEvent("onload", function(){scrollerinstance.initialize()})



else if (document.getElementById) //if legacy DOM browsers, just start scroller after 30 sec



setTimeout(function(){scrollerinstance.initialize()}, 1000)



}







// -------------------------------------------------------------------



// initialize()- Initialize scroller method.



// -Get div objects, set initial positions, start up down animation



// -------------------------------------------------------------------







pausescroller.prototype.initialize=function(){



this.tickerdiv=document.getElementById(this.tickerid)



this.visiblediv=document.getElementById(this.tickerid+"1")



this.hiddendiv=document.getElementById(this.tickerid+"2")



this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))



//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)



this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"



this.getinline(this.visiblediv, this.hiddendiv)



this.hiddendiv.style.visibility="visible"



var scrollerinstance=this



document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}



document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}



if (window.attachEvent) //Clean up loose references in IE



window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})



setTimeout(function(){scrollerinstance.animateup()}, this.delay)



}



// -------------------------------------------------------------------



// animateup()- Move the two inner divs of the scroller up and in sync



// -------------------------------------------------------------------



pausescroller.prototype.animateup=function(){



var scrollerinstance=this



if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){



this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"



this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"



setTimeout(function(){scrollerinstance.animateup()}, 50)



}



else{



this.getinline(this.hiddendiv, this.visiblediv)



this.swapdivs()



setTimeout(function(){scrollerinstance.setmessage()}, this.delay)



}



}





// -------------------------------------------------------------------



// swapdivs()- Swap between which is the visible and which is the hidden div



// -------------------------------------------------------------------



pausescroller.prototype.swapdivs=function(){



var tempcontainer=this.visiblediv



this.visiblediv=this.hiddendiv



this.hiddendiv=tempcontainer



}







pausescroller.prototype.getinline=function(div1, div2){



div1.style.top=this.visibledivtop+"px"



div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"



}



// -------------------------------------------------------------------



// setmessage()- Populate the hidden div with the next message before it's visible



// -------------------------------------------------------------------



pausescroller.prototype.setmessage=function(){



var scrollerinstance=this



if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)



setTimeout(function(){scrollerinstance.setmessage()}, 50)



else{



var i=this.hiddendivpointer



var ceiling=this.content.length



this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1



this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]



this.animateup()



}



}



pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any



if (tickerobj.currentStyle)



return tickerobj.currentStyle["paddingTop"]



else if (window.getComputedStyle) //if DOM2



return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")



else



return 0



}
