var oLastBtn=0;
//================================
var rate = 20;
var obj;
var act = 0;
var elmH = 0;
var elmS = 128;
var elmV = 255;
var clrOrg;
var TimerID;

if (navigator.appName.indexOf("Microsoft",0) != -1 && parseInt(navigator.appVersion) >= 4) {
    Browser = true;
} else {
    Browser = false;
}

if (Browser) {
    document.onmouseover = doRainbowAnchor;
    document.onmouseout = stopRainbowAnchor;
}

function doRainbow()
{
    if (Browser && act != 1) {
        act = 1;
        obj = event.srcElement;
        clrOrg = obj.style.color;
        TimerID = setInterval("ChangeColor()",100);
    }
}

function stopRainbow()
{
    if (Browser && act != 0) {
        obj.style.color = clrOrg;
        clearInterval(TimerID);
        act = 0;
    }
}

function doRainbowAnchor()
{
    if (Browser && act != 1) {
        obj = event.srcElement;

        while (obj.tagName != 'A' && obj.tagName != 'BODY') {
            obj = obj.parentElement;
            if (obj.tagName == 'A' || obj.tagName == 'BODY')
                break;
        }

        if (obj.tagName == 'A' && obj.href != '') {
            act = 1;
            clrOrg = obj.style.color;
            TimerID = setInterval("ChangeColor()",100);
        }
    }
}

function stopRainbowAnchor()
{
    if (Browser && act != 0) {
        if (obj.tagName == 'A') {
            obj.style.color = clrOrg;
            clearInterval(TimerID);
            act = 0;
        }
    }
}

function ChangeColor()
{
    obj.style.color = makeColor();
}

function makeColor()
{

	if (elmS == 0) {
        elmR = elmV;    elmG = elmV;    elmB = elmV;
    }
    else {
        t1 = elmV;
        t2 = (255 - elmS) * elmV / 255;
        t3 = elmH % 60;
        t3 = (t1 - t2) * t3 / 60;

        if (elmH < 60) {
            elmR = t1;  elmB = t2;  elmG = t2 + t3;
        }
        else if (elmH < 120) {
            elmG = t1;  elmB = t2;  elmR = t1 - t3;
        }
        else if (elmH < 180) {
            elmG = t1;  elmR = t2;  elmB = t2 + t3;
        }
        else if (elmH < 240) {
            elmB = t1;  elmR = t2;  elmG = t1 - t3;
        }
        else if (elmH < 300) {
            elmB = t1;  elmG = t2;  elmR = t2 + t3;
        }
        else if (elmH < 360) {
            elmR = t1;  elmG = t2;  elmB = t1 - t3;
        }
        else {
            elmR = 0;   elmG = 0;   elmB = 0;
        }
    }

    elmR = Math.floor(elmR);
    elmG = Math.floor(elmG);
    elmB = Math.floor(elmB);

    clrRGB = '#' + elmR.toString(16) + elmG.toString(16) + elmB.toString(16);

    elmH = elmH + rate;
    if (elmH >= 360)
        elmH = 0;

    return clrRGB;
}

//================================
function wireOpen()
{if (version == "e4")
{document.write("<marquee behavior=scroll direction=up width=200 height=50 scrollamount=1 scrolldelay=75 onmouseover='this.stop()' onmouseout='this.start()'>")}}

function wireClose()
{if (version == "e4")
{document.write("</marquee>")}}

var  tbao="Chao mung ban ghe tham WebSite \n :: The duc The thao BINH THUAN::";
function Click(clk){
  if(document.all)   {
    if(event.button == 2)     {
		      alert(tbao);
		      return false;
		    }
	              }

  if(document.layers)   {
		    if(clk.which == 3)     {
		      alert(tbao);
		      return false;
  		  }
		 }
}
if(document.layers) {
  		document.captureEvents(Event.MOUSEDOWN);
}
//document.onmousedown=Click;
//================================
function disableselect(e){
return false
}
function reEnable(){
return true
}
document.onselectstart=new Function ("return false")//if IE4+
if (window.sidebar){//if NS6
document.onmousedown=disableselect
document.onclick=reEnable
}
//================================

function mouseoutlink(link) {
	link.style.textDecorationNone = "None";
}

//===========================================


function showLines(thingy) {
wotsit = eval("IDM_"+thingy);
if (wotsit.style.display == "none") {
tidyUp();
wotsit.style.display="";
//eval(thingy).src="images/bi-1.gif";
} else {
wotsit.style.display="none";
//eval(thingy).src="images/bi.gif";
}
}

function tidyUp() {
	IDM_1.style.display="none";
	IDM_2.style.display="none";
	IDM_3.style.display="none";
	IDM_4.style.display="none";
	IDM_5.style.display="none";
	IDM_6.style.display="none";
	//IDM_7.style.display="none";
	//IDM_8.style.display="none";
}
//==========================================================
timeID = 420;
stringcount = 11;
msg = "Chao mung BAN den tham WebSite The duc The thao BINH THUAN";
themsg = new Array(33);
	themsg[0]=msg;
	blink = "                                                                            ";
	for (i=1; i<32; i++)
	{
		b = blink.substring(0,i);
		themsg[i]="";
		for (j=0; j<msg.length; j++) themsg[i]=themsg[i]+msg.charAt(j)+b;
	}

function wiper()
{
	if (stringcount > -1) str = themsg[stringcount]; else str = themsg[0];
	if (stringcount-- < -40) stringcount=31;
	status = str;
	clearTimeout(timeID);
	timeID = setTimeout("wiper()",200);
}

function initTimelines() {
    var ns = navigator.appName == "Netscape";
    document.Time = new Array(1);
    document.Time[0] = new Array(1);
    document.Time["Timeline1"] = document.Time[0];
    document.Time[0].Name = "Timeline1";
    document.Time[0].fps = 15;
    document.Time[0][0] = new String("sprite");
    document.Time[0][0].slot = 1;
    if (ns)
        document.Time[0][0].obj = document.Layer1;
    else
        document.Time[0][0].obj = document.all ? document.all["Layer1"] : null;
    document.Time[0][0].keyFrames = new Array(1, 15);
    document.Time[0][0].values = new Array(2);
    document.Time[0][0].values[0] = new Array(-110,-100,-95,-87,-71,-63,-51,-40,-33,-26,-14,-9,-5,-2,0);
    document.Time[0][0].values[0].prop = "left";
    document.Time[0][0].values[1] = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
    document.Time[0][0].values[1].prop = "top";
    if (!ns) {
        document.Time[0][0].values[0].prop2 = "style";
        document.Time[0][0].values[1].prop2 = "style";
    }
    document.Time[0].lastFrame = 15;
    for (i=0; i<document.Time.length; i++) {
        document.Time[i].ID = null;
        document.Time[i].curFrame = 0;
        document.Time[i].delay = 1000/document.Time[i].fps;
    }
}
function timelinePlay(tmLnName, myID) 
{ //v1.2

wiper();

  var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,propNum,theObj,firstTime=false;
  if (document.Time == null) initTimelines(); //if *very* 1st time
  tmLn = document.Time[tmLnName];
  if (myID == null) { myID = ++tmLn.ID; firstTime=true;}//if new call, incr ID
  if (myID == tmLn.ID) { //if Im newest
    setTimeout('timelinePlay("'+tmLnName+'",'+myID+')',tmLn.delay);
    fNew = ++tmLn.curFrame;
    for (i=0; i<tmLn.length; i++) {
      sprite = tmLn[i];
      if (sprite.charAt(0) == 's') {
        if (sprite.obj) {
          numKeyFr = sprite.keyFrames.length; firstKeyFr = sprite.keyFrames[0];
          if (fNew >= firstKeyFr && fNew <= sprite.keyFrames[numKeyFr-1]) {//in range
            keyFrm=1;
            for (j=0; j<sprite.values.length; j++) {
              props = sprite.values[j]; 
              if (numKeyFr != props.length) {
                if (props.prop2 == null) sprite.obj[props.prop] = props[fNew-firstKeyFr];
                else        sprite.obj[props.prop2][props.prop] = props[fNew-firstKeyFr];
              } else {
                while (keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]) keyFrm++;
                if (firstTime || fNew==sprite.keyFrames[keyFrm-1]) {
                  if (props.prop2 == null) sprite.obj[props.prop] = props[keyFrm-1];
                  else        sprite.obj[props.prop2][props.prop] = props[keyFrm-1];
        } } } } }
      } else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value);
      if (fNew > tmLn.lastFrame) tmLn.ID = 0;
  } }
}
//======================================
function verify(theForm)
	{
		with(theForm)
		{
			if(name.value == ""){
				alert('Error : Your name !')
				name.focus()
				return false
			}
			if(address.value == ""){
				alert('Error : Address !')
				address.focus()
				return false
			}
			if(tel.value == ""){
				alert('Error : Phone number !')
				tel.focus()
				return false
			}

			if(email.value != ""){
				if(email.value.indexOf("@")<0 || email.value.indexOf(".")<0){
					alert('Error Email - Exp: name@yahoo.com')
					email.focus()
					return false
				}
			}
			if(content.value == ""){
				alert('Error : Messages !')
				content.focus()
				return false
			}
			
		}
	}

//================================================
var sOpenMenuID = ""
var iTimerID 
var s="::: Chao mung ban den Ham Thuan Bac - Binh Thuan !!! :::  ----------  ::: Welcome to Ham Thuan Bac - Binh Thuan ::: ------------- "

function Chaychu(s) {
   	window.status=s
   	var c=s.substring(0,1)
   	s=s.substring(1,s.length)+c
  	var lenh="Chaychu('" + s + "')"
  	timer2=window.setTimeout(lenh,100)
 	}
//--------------------------------------
