﻿// JScript 檔
function Checksearch(defaultValue,ErrorMessage,isfocus){
var q=trim(document.getElementById("q").value);
	if (q==""||q==defaultValue){
	alert(ErrorMessage);
	return false;
	}
var url='http://www.google.com/search?ie=UTF-8&oe=UTF-8&q=' + encodeURI(q) + '&domains=www.songchuan.com&sitesearch=www.songchuan.com';
var asearch=document.getElementById("asearch");
asearch.href=url;
if (isfocus!=null){
asearch.focus();
}else{
asearch.click();
}

//window.open(url);	
}

function txtClear(txt,defaultValue){
 if (txt.value==defaultValue){
 txt.value="";
 }
}

function trim(instr){
  return instr.replace(/^[\s]*/gi,"").replace(/[\s]*$/gi,"");
}

function checkEnter(){
    if (window.event.keyCode == 13){
    Checksearch('Search','Please enter keyword',true);
    }
    }  

    
//window.onkeydown=alert('111'); 
