﻿
function showSearchMenuChangeColor(obj)
{
	obj.style.background='blue'
	obj.style.color='white'
}
function hideSearchMenuChangeColor(obj)
{
	obj.style.background='gainsboro'
	obj.style.color='blue'
}




function searchClick(lang)
{
	if(lang=='CnSmpl')
	{
					document.getElementById(Label_forChain).innerHTML='全程搜索结果';
	}
	else
	{
		if(lang=='CnTrdt')
		{
				document.getElementById(Label_forChain).innerHTML='全程搜索結果';
		}
		else
		{
			if(lang=='Englsh')
			{
					document.getElementById(Label_forChain).innerHTML='Full Search Result';
			}
			else
			{
					document.getElementById(
					).innerHTML='全程搜索結果';
					lang='CnTrdt';
			}
		}
	}
	document.getElementById('mainwin').src='yjobitem.aspx?LanguageCode='+lang+'&ylSearch=BYQALL';
}

function whichKBButton(lang,event,sc)
{
	if(event.keyCode==13)
	{
			searchClick(lang,sc);
	}
}

function clickedMe(ts)
{
	ts.select();
}



function redirectmeWithScreenWidth()
{
window.location="yongslist.aspx?Swcirdetehn="+screen.availWidth
//window.location="yongslist.aspx?Swcirdetehn="+screen.availWidth+"&LanguageCode=Englsh"
//window.open("yongslist.aspx?ScreenWidth="+screen.availWidth,"_self","channelmode=yes, fullscreen=yes");
                                                                    
}

var interval
movingCnt=0
movingLength=220 //width
movingTime=950   //time 
startLeftPosition=screen.availWidth-220 //left position 260+24=280
leftPosition=startLeftPosition
speed=50



function scrollit()
{
	//document.getElementById('movingdisplay').innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;那裏有華人 那裏就有勇的分類廣告 免費刊登 免費查詢 廣告效力宏大 波及全球';
	//document.getElementById('movingdisplay').innerHTML='那裏有華人，那裏就有 “勇的分類廣告”。廣告效力宏大，波及全球。';
	//scrollit2();
	blinking_header();
	document.getElementById('searchInput01').focus();

}

function scrollit2()
{
if (movingCnt!=movingTime)
	{
	movingCnt=movingCnt+1
	leftPosition=leftPosition-1
	document.getElementById('movingdisplay').style.clip="rect(0 " + (movingCnt + movingLength) + " 18 "+movingCnt+")"
	//document.getElementById('movingdisplay').style.clip="rect(0 150 20 0)"
	document.getElementById('movingdisplay').style.left=leftPosition
	interval=setTimeout("scrollit2()",speed)
	}
else
	{
    movingCnt=0
	leftPosition=startLeftPosition
	interval=setTimeout("scrollit2()",speed)
	}
}

function stopinterval()
{
	clearTimeout(interval)
	stoptimer();
}

var blinktimer

function blinking_header()
{
if (!document.getElementById('LabelPosition1').style.color)
	{
	document.getElementById('LabelPosition1').style.color="red"
	}
if (document.getElementById('LabelPosition1').style.color=="red")
	{
	document.getElementById('LabelPosition1').style.color="blue"
	}
else
	{
	document.getElementById('LabelPosition1').style.color="red"
	}
blinktimer=setTimeout("blinking_header()",700)
}

function stoptimer()
{
	clearTimeout(blinktimer)
}


function reset_all_button() {
/*
	document.getElementById('home').style.color=""
	document.getElementById('products').style.color=""
	document.getElementById('support').style.color=""
	document.getElementById('aboutus').style.color=""
	document.getElementById('contactus').style.color=""
	*/

}

function home_onclick() {
    reset_all_button();
	//document.getElementById('home').style.color="red"
				window.open("index.htm","_self")
}

function products_onclick() {
    reset_all_button();
	//document.getElementById('products').style.color="red"
				window.open("products.htm","_self")

}

function devices_onclick() {
    reset_all_button();
	//document.getElementById('products').style.color="red"
				window.open("devices.htm","_self")

}

function support_onclick() {
    //reset_all_button();
	//document.getElementById('support').style.color="red"
				window.open("support.aspx","_self")

}

function aboutus_onclick() {
    reset_all_button();
	//document.getElementById('aboutus').style.color="red"
				window.open("aboutus.htm","_self")

}

function contactus_onclick() {
    reset_all_button();
	//document.getElementById('contactus').style.color="red"
				window.open("contactus.aspx","_self")

}

var btn1="index";
var btn2="products";
var btn3="devices";
var btn4="support";
var btn5="aboutus";
var btn6="contactus";

var frameStyle = new Array()
frameStyle[0] = "none";
frameStyle[1] = "dotted";
frameStyle[2] = "dashed";
frameStyle[3] = "solid";
frameStyle[4] = "double";
frameStyle[5] = "ridge";
frameStyle[6] = "inset";
frameStyle[7] = "outset";
frameStyle[8] = "hidden";
frameStyle[9] = "groove";
var frameStyle2 = new Array()
frameStyle2[0] = "none";
frameStyle2[1] = "dotted";
frameStyle2[2] = "dashed";
frameStyle2[3] = "solid";
frameStyle2[4] = "double";
frameStyle2[5] = "ridge";
frameStyle2[6] = "outset";
frameStyle2[7] = "inset";
frameStyle2[8] = "hidden";
frameStyle2[9] = "groove";

var frameColor = new Array()
frameColor[0] = "#000000";

/*
    border-right-color:Aqua; 
    border-right-color:Black; 
    border-right-color:Blue; 
    border-right-color:Fuchsia; 
    border-right-color:Gray; 
    border-right-color:Green; 
    border-right-color:Lime; 
    border-right-color:Maroon; 
    border-right-color:Navy; 
    border-right-color:Olive; 
    border-right-color:Orange; 
    border-right-color:Purple; 
    border-right-color:Red; 
    border-right-color:Silver; 
    border-right-color:Teal; 
    border-right-color:White; 
    border-right-color:Yellow; 
    */


function createMenu(id)
{

var d = new Date();
var dn = d.getMinutes() % 8;
//alert(frameStyle[dn])
document.getElementById('yhContent').style.borderLeftStyle=frameStyle[dn];
//alert(frameStyle[dn])
document.getElementById('yhContent').style.borderRightStyle=frameStyle2[dn];




	 document.getElementById(id).style.color="#ff0000";
	 
	 //<tr><td class="menu" id="mn1"  onmouseover="highlight('mn1')" onmouseout="dehighlight('mn1')" onclick="return devices_onclick()">Devices</td></tr>

	var nid = "yhMenu_"+id;
	if(document.getElementById(nid))
	{
	    if(id=='notepad_template')
	    {
		    document.getElementById(nid).innerHTML=
		    "<a href='http://www.abc.com' target='_blank'>ABC</a><br />"+
		    "<a class='btm_lbl' id='A5' href='contactus.aspx' target='_self'>Contact us</a>";
	    }
	    if(id==btn1)
	    {
    	
    		
		    document.getElementById(nid).innerHTML=
		    "<a class='btm_lbl' id='A1' href='index.htm' target='_self'>Home</a><br />" +
		    "<a class='btm_lbl' id='A2' href='index_newscal.htm' target='_self'>News Calendar</a><br />";
	    }
	    if(id==btn2)
	    {
	    //alert(id);
		    document.getElementById(nid).innerHTML=
		    "<a class='btm_lbl' id='A1' href='products_download.aspx?productid=1' target='_self'>CAN Studio Trial</a><br />"+
		    "<a class='btm_lbl' id='A2' href='products_usermanl.htm' target='_self'>CAN Studio User Manual</a><br />"+
		    "<a class='btm_lbl' id='A3' href='products_license.htm' target='_self'>User License Agreement</a><br />";
	    }
	    if(id==btn3)
	    {
		    document.getElementById(nid).innerHTML=
		    "<a class='btm_lbl' id='A1' href='devices.htm' target='_self'>Devices</a><br />" +
		    "<a class='btm_lbl' id='A2' href='devices_cmpr.htm' target='_self'>Device Comparison</a><br />";
	    }
	    if(id==btn4)
	    {
		    document.getElementById(nid).innerHTML=
		    "<a class='btm_lbl' id='A1' href='support.aspx' target='_self'>Support</a><br />" +
		    "<a class='btm_lbl' id='A2' href='support_ptndl.aspx?OpCode=0' target='_self'>Partner's Edition</a><br />";
	    }
	    if(id==btn5)
	    {
	    }
	    if(id==btn6)
	    {
	    }
	}
	/*
    C:\y\teknewell\teknewell.com\index_newscal.htm
    C:\y\teknewell\teknewell.com\products_download.aspx
    C:\y\teknewell\teknewell.com\products_usermanl.htm
    C:\y\teknewell\teknewell.com\products_license.htm
    C:\y\teknewell\teknewell.com\devices_cmpr.htm
    */

    var r=document.getElementById(btn1+"tb").insertRow(0);
    var c=r.insertCell(0);
    c.innerHTML="News Calendar";
    c.id="index_newscal.htm";
    c.className="menu";
    c.onmouseover=highlight;
    c.onmouseout=dehighlight;
    c.onclick=executeMenu;

    r=document.getElementById(btn2+"tb").insertRow(0);
    c=r.insertCell(0);
    c.innerHTML="User License Agreement";
    c.id="products_license.htm";
    c.className="menu";
    c.onmouseover=highlight;
    c.onmouseout=dehighlight;
    c.onclick=executeMenu;
    r=document.getElementById(btn2+"tb").insertRow(0);
    c=r.insertCell(0);
    c.innerHTML="CAN Studio User Manual";
    c.id="products_usermanl.htm";
    c.className="menu";
    c.onmouseover=highlight;
    c.onmouseout=dehighlight;
    c.onclick=executeMenu;
    r=document.getElementById(btn2+"tb").insertRow(0);
    c=r.insertCell(0);
    c.innerHTML="CAN Studio Trial";
    c.id="products_download.aspx";
    c.className="menu";
    c.onmouseover=highlight;
    c.onmouseout=dehighlight;
    c.onclick=executeMenu;

    r=document.getElementById(btn3+"tb").insertRow(0);
    c=r.insertCell(0);
    c.innerHTML="Device Comparison";
    c.id="devices_cmpr.htm";
    c.className="menu";
    c.onmouseover=highlight;
    c.onmouseout=dehighlight;
    c.onclick=executeMenu;
    
    r=document.getElementById(btn4+"tb").insertRow(0);
    c=r.insertCell(0);
    c.innerHTML="Partner's Edition";
    c.id="support_ptndl.aspx?OpCode=0";
    c.className="menu";
    c.onmouseover=highlight;
    c.onmouseout=dehighlight;
    c.onclick=executeMenu;
     

   /*
    alert(btn1+"td");
    alert(btn2+"td");
    alert(btn3+"td");
    alert(btn4+"td");
    alert(btn5+"td");
    alert(btn6+"td");
    document.getElementById(btn1+"td").style.visibility="hidden";
    document.getElementById(btn2+"td").style.visibility="hidden";
    document.getElementById(btn3+"td").style.visibility="hidden";
    document.getElementById(btn4+"td").style.visibility="hidden";
    document.getElementById(btn5+"td").style.visibility="hidden";
    document.getElementById(btn6+"td").style.visibility="hidden";
    */
    /*
    document.getElementById(btn1+"td").style.margin="0px";
    document.getElementById(btn2+"td").style.margin="0px";
    document.getElementById(btn3+"td").style.margin="0px";
    document.getElementById(btn4+"td").style.margin="0px";
    document.getElementById(btn5+"td").style.margin="0px";
    document.getElementById(btn6+"td").style.margin="0px";
    document.getElementById(btn1+"td").style.padding="0px";
    document.getElementById(btn2+"td").style.padding="0px";
    document.getElementById(btn3+"td").style.padding="0px";
    document.getElementById(btn4+"td").style.padding="0px";
    document.getElementById(btn5+"td").style.padding="0px";
    document.getElementById(btn6+"td").style.padding="0px";
    document.getElementById(btn1+"td").style.border="0px";
    document.getElementById(btn2+"td").style.border="0px";
    document.getElementById(btn3+"td").style.border="0px";
    document.getElementById(btn4+"td").style.border="0px";  
    document.getElementById(btn5+"td").style.border="0px";
    document.getElementById(btn6+"td").style.border="0px";
    */
}

function showmenu(elmnt)
{
document.getElementById(elmnt+'tb').style.visibility="visible";
}
function hidemenu(elmnt)
{
document.getElementById(elmnt+'tb').style.visibility="hidden";
}
function highlight(e)
{

    var targ;
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;

    document.getElementById(targ.id).style.backgroundImage="url(menuhighlight.png)";
    //document.getElementById(targ.id).style.backgroundColor="#cee8f9";
    //alert("aaa"+window.event.type+"|"+targ.innerHTML);
    document.getElementById(targ.id).style.cursor="pointer";
}
function dehighlight(e)
{
    var targ;
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;
    document.getElementById(targ.id).style.backgroundImage="url(menudehighlight.png)";
    //document.getElementById(targ.id).style.backgroundColor="#b5c791";
    document.getElementById(targ.id).style.cursor="auto";
}


function executeMenu(e)
{
    var targ;
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;
				window.open(targ.id,"_self")
		/*
	if(targ.id==btn1+"mn1")
				window.open("index_newscal.htm","_self")
	if(targ.id==btn2+"mn1")
				window.open("products_download.htm","_self")
	if(targ.id==btn2+"mn2")
				window.open("products_usermanl.htm","_self")
	if(targ.id==btn2+"mn3")
				window.open("products_license.htm","_self")
	if(targ.id==btn3+"mn1")
				window.open("devices_cmpr.htm","_self")
				*/
}
//function showmenu(id)
//{
    //var nid = "yhMenu_"+id;
    /*
    var p;
    p=window.createPopup();
    var pbody=p.document.body;
    pbody.style.backgroundColor="#acdcf7";
    pbody.style.border="solid black 0px";
    pbody.innerHTML=document.getElementById(nid).innerHTML;
    p.show(3,22,250,50,document.getElementById(id));
    */
    /*
    alert(id+"td");
    document.getElementById(id+"td").innerHTML=document.getElementById(nid).innerHTML;
    document.getElementById(id+"td").style.visibility="visible";
    */
    

//}
//function hidemenu(id)
//{
    //p.hide();
    //document.getElementById(id+"td").style.visibility="hidden";
//}


//	background-color:#b9cb94


function eurToUsd()
{
var vi = document.getElementById("text1").value;
var vo = vi / 2; 
document.getElementById("text2").value = vo;

}
function usdToEur()
{
var vi = document.getElementById("text3").value;
var vo = vi * 2; 
document.getElementById("text4").value = vo;

}

/*
EUR <input type="text" id="text1" value="100" style="width:50px" />
<input type="button" id="button1" onclick="eurToUsd()" value="convert to" />
U.S.$&nbsp;<input type="text" id="text2" value="" style="width:50px" /><br>
U.S.$&nbsp;<input type="text" id="text3" value="100" style="width:50px" />
<input type="button" id="button2" onclick="usdToEur()" value="convert to" />
EUR <input type="text" id="text4" value="" style="width:50px" />
*/
