// JavaScript Document
function $(elementId){ 
	if (document.getElementById) {
		return document.getElementById(elementId); 
	}else if(document.all) {
		return document.all[elementId]; 
	}else if(document.layers) {
		return document.layers[elementId]; 
	}
}

function swapIco(o,m,n){
	if(m==1){
		o.src="Images/m"+n+"_.jpg";	
	}else{
		o.src="Images/m"+n+".jpg";
	}
}

function chkform(){
    if($("Contact_1").value==""){
        $("txt1").innerHTML=(" * Please fill in your name.");
		fadeOut(1);
        $("Contact_1").focus();
        return false;
    }
    if($("Contact_2").value==""){
        $("txt2").innerHTML=(" * Email cannot be empty (i.e. xxx@xxx.com).");
		fadeOut(2);
        $("Contact_2").focus();
        return false;
    }
    if($("Contact_6").value==""){
        $("txt4").innerHTML=(" * Subject cannot be empty.");
		fadeOut(3);
        $("Contact_6").focus();
        return false;
    }
    if($("Contact_5").value==""){
        $("txt3").innerHTML=(" * Content cannot be empty.");
		fadeOut(3);
        $("Contact_5").focus();
        return false;
    }
}

function fadeOut(N){
	function a(){
		$("txt"+N).innerHTML=" *"
	}
var b=setTimeout(a,3000);
}


function getItem(){
var Request = new Object();
Request = GetRequest(); 
var Type;
if(Request["Type"]==undefined){
	Type="1";	
}else{
	Type=Request["Type"];	
};
switch(Type){
	case "1":
		$("t1").className="cr2";break;
		case "2":
		$("t2").className="cr2";break;
		case "3":
		$("t3").className="cr2";break;
		case "4":
		$("t4").className="cr2";break;
		default:
		$("t1").className="cr2";
	}
}


function getPort(){
var Request = new Object();
Request = GetRequest(); 
var Type;
if(Request["Type"]==undefined){
	Type="6";	
}else{
	Type=Request["Type"];	
};
switch(Type){
	case "1":
		$("t1").className="a1";break;
		case "2":
		$("t2").className="a1";break;
		case "3":
		$("t3").className="a1";break;
		case "4":
		$("t4").className="a1";break;
		case "5":
		$("t5").className="a1";break;
		case "6":
		$("t6").className="a1";break;
		case "7":
		$("t7").className="a1";break;
		case "8":
		$("t8").className="a1";break;
		case "9":
		$("t9").className="a1";break;
		case "10":
		$("t10").className="a1";break;
		default:
		$("t6").className="a1";
	}
}
function tabIn(o){
	o.focus();
	o.select(); 
}

//所有的输入框,单击即被选中
function selectInput(){
var tt=document.getElementsByTagName("input");
	for (var i=0;i<tt.length;i++){
		if (tt[i].type=="text"){ 
			tt[i].onclick=function(){tabIn(this);}
		}
	}	
}

//去除空格
function ltrim(s){return s.replace( /^\s*/, '');} 
function rtrim(s){return s.replace( /\s*$/, '');} 
function trim(s){return rtrim(ltrim(s));}

function keyUp(o,e,t){ 
//t为空则只允许输入数字,
//t=1 数字和英文,
//t=2数字和(.)小数点,
//t=3数字和: 
var e = window.event || e;
if(t==undefined||t==null||t==""){if(e.keyCode!=9) {o.value=o.value.replace(/[^\d]/g,'');}}else if(t==1){if(e.keyCode!=9) {o.value=o.value.replace(/[^a-zA-Z0-9]/g,'');}}else if(t==2){ if(e.keyCode!=9) {o.value=o.value.replace(/[^\d&.]/g,'');	 }}else if(t==3){if(e.keyCode!=9) {o.value=o.value.replace(/[^\d&:]/g,'');}}}

//隐藏/显示下拉列表
var _selectArr=[];
function hideSelect(N){var eSel=document.getElementsByTagName("select");if(N==0){for(var i=0;i<eSel.length;i++){if(eSel[i].style.visibility=="hidden"){_selectArr.push(i);}else {eSel[i].style.visibility="hidden";}}}else {var ehLen=(_selectArr.length);if(ehLen>0){for(var i=0;i<eSel.length;i++){for(var j=0;j<ehLen;j++){if(_selectArr[j]!=i){eSel[i].style.visibility="visible";}}}}else{for(var i=0;i<eSel.length;i++){ eSel[i].style.visibility="visible"; }}}}

function attachEvt(evt){
	if(navigator.userAgent.indexOf("MSIE")>=0){    
		window.attachEvent("onload", evt);
	}else{    
		window.addEventListener("load", evt, true);
	}
}

function GetRequest() { 
   var url = location.search; //获取url中"?"符后的字串
   var theRequest = new Object();
   if (url.indexOf("?") != -1) {
      var str = url.substr(1);
      strs = str.split("&");
      for(var i = 0; i < strs.length; i ++) {
         theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);
      }
   }
   return theRequest;
}

var info =    
     {  
        "testis":    
             [    
                 {"user":"Veeravith","testi":"Recommend to you for the project. They are all professional and will help you to finished your project with quality of work and reasonable price. And I just start second project with them so happy to work with them. And thank you for their hard work."},    
				 {"user":"Gary Parker","testi":"Linda did a GREAT job responding to my requests in timely manner. My new logo is just what I was looking for!!! Great communication! Thank You!."},
				 {"user":"Bryan Wagner","testi":"Everything was smooth as can be, every request and revision that I had was taken into consideration and executed perfectly. HIGHLY Recommend Lavender and her services! Fantastic!"},
				 {"user":"Veeravith","testi":"Recommend to you for the project. They are all professional and will help you to finished your project with quality of work and reasonable price. And I just start second project with them so happy to work with them. And thank you for their hard work."},
				 {"user":"Platinum Care","testi":"Professional, prompt, competent and excellent communication. Very customer oriented!"}
             ]    
     };
