function getSelectedText(name){

	var obj=document.getElementById(name);
	
	for(i=0;i<obj.length;i++){
	
		if(obj[i].selected==true){
		
		   
		   document.getElementById("timecontry").value=obj[i].innerText; 
		
		}
	
	}

}

function CheckAll(form)  {         
  for (var i=0;i<form.elements.length;i++)    {         
    var e = form.elements[i];         
    if (e.name != 'chkall')       e.checked = form.chkall.checked;          
   }         
}   
  
function showDiv(id,total){  
 for(var i=0; i<total;i++){
     if(i==id){
	   document.getElementById("showcontent"+i).style.display="block";
	 }else{
	   document.getElementById("showcontent"+i).style.display="none";
	 }
 }
}
function showSearchtype(showtype){ 
     if(showtype==2){
		document.getElementById('search_byname').style.display="block";
		document.getElementById('search_byname_link').style.display="block";
		
		document.getElementById('search_byrange').style.display="none";
		document.getElementById('search_byrange_link').style.display="none";
		
		
	}else{
		document.getElementById('search_byname').style.display="none";
		document.getElementById('search_byname_link').style.display="none";
		
		document.getElementById('search_byrange').style.display="block";
		document.getElementById('search_byrange_link').style.display="block";
		
	}
	
}


function showLists(old_menu,old_pic){ 
    var targetImg = document.getElementById(old_menu); 
    if(targetImg.style.display=="block"){
        targetImg.style.display="none";
    }else if(targetImg.style.display=="none"){
        targetImg.style.display="block";
    }
	
	var targetImg = document.getElementById(old_pic);
	var v=targetImg.src;
	
    if(v.indexOf("icon_articles_jian")==-1){
		
        targetImg.src="images/icon_articles_jian.jpg";
		
    }else{
		targetImg.src="images/icon_articles_add.jpg";
		
	}
	
	
    
}

function subLoginForm(fid)
{
    var ef=G(fid);
    if(ef.username.value=='')
  {
     ShowInfo("Username must be required!");
	 return false; 
  }
     
   if(ef.password.value=='')
  {
     ShowInfo("Password must be required!");
	 return false; 
  }else{
  
     ajax.postf(
	   fid,
	   function(obj)
	   {
	     
		 if(obj.responseText!='good')
		 {
		   ShowInfoRe(obj.responseText);
		   return true;
		 }else{
		   gotoreload();
		   return true;
		 }
	   }

	);
  
  
  }

return true;

}
function AddFavorite(url, site)
{
	
	try
    {
        window.external.AddFavorite(sURL, sTitle);
    }
    catch (e)
    {
        try
        {
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e)
        {
            if (navigator.userAgent.toLowerCase().indexOf('opera') > -1) {
		       alert("Please use Ctrl + T to bookmark");
			} else {
				alert("Please use Ctrl + D to bookmark");
			}
	
        }
    }
	
}

function IsChecked(oform,checkname){    
   var len = oform.elements.length;    
   var i=0;    
   for( i=0; i<len; i++){    
       if (oform.elements[i].name==checkname){    
           if(oform.elements[i].checked){    
               return true;    
            }    
        }    
    }    
   return false;    
}    
function GetCheckedNum(oform,checkname){    
   var len = oform.elements.length;    
   var i=0;    
   var checkn = 0;    
   for( i=0; i<len; i++){    
       if (oform.elements[i].name==checkname){    
           if(oform.elements[i].checked){    
                checkn++;    
            }    
        }    
    }    
   return checkn;    
}    
function IsChecked(oform,checkname){    
   var len = oform.elements.length;    
   var i=0;    
   for( i=0; i<len; i++){    
       if (oform.elements[i].name==checkname){    
           if(oform.elements[i].checked){    
               return true;    
            }    
        }    
    }    
   return false;    
}    
function getRadioValue(oform,radioname){    
   var len = oform.elements.length;    
   var i=0;    
   var checkn = "";    
   for( i=0; i<len; i++){    
       if (oform.elements[i].name==radioname){    
           if(oform.elements[i].checked){    
                checkn=oform.elements[i].value;    
            }    
        }    
    }    
   return checkn;    
}  

function getCheckValue(oform,radioname){    
   var len = oform.elements.length;    
   var i=0;    
   var checkn = "";    
   for( i=0; i<len; i++){    
       if (oform.elements[i].name==radioname){    
           if(oform.elements[i].checked){    
                checkn=checkn+oform.elements[i].value+",";    
            }    
        }    
    }  
   
   checkn=checkn.substr(0,checkn.length-1);
   return checkn;    
}

function getArrValue(oform,radioname){ 
        
   var len = oform.elements.length;    
   var i=0;    
   var checkn = "";    
   for( i=0; i<len; i++){    
       if (oform.elements[i].name==radioname){    
           checkn=checkn+oform.elements[i].value+",";    
        }    
    }  
   checkn=checkn.substr(0,checkn.length-1);
   return checkn;    
}


function validateEmail(url,email)
{


  $isEmail=checkEmail(email);
  if(!$isEmail)
  {
	   ShowInfo('<span style="font-size:12px; color:#999999">The email is not correct, please confirm</span>'); 
	   return false;
  }
  else
  {
    saveEmail(url,email);
	return false;
  }
}

function checkEmail(email)
{
  if(!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(email)) 
  { 
   
    return false; 
  }
  else
  {
	  return true;
  }
}
function isNumber(val)
{
  var reg = /^[\d|\.|,]+$/;
  return reg.test(val);
}

function saveEmail(url,email)
{
  var url = url+"&email="+email;
  g_pop=new Popup({ contentType:1,isReloadOnClose:false,scrollType:false,width:300,height:80});
  g_pop.setContent("title","Submit successfully!");
  g_pop.setContent("contentUrl",url);
  g_pop.build();
  g_pop.show();
}

function ShowInfo(str)
{
  g_pop=new Popup({ contentType:4,isReloadOnClose:false,width:340,height:80});
  g_pop.setContent("title","System");
  g_pop.setContent("alertCon",'<span style="font-size:12px; color:red">'+str+'</span>');
  g_pop.build();
  g_pop.show();	
}
function ShowInfoGo(str)
{
  g_pop=new Popup({ contentType:5,isReloadOnClose:false,width:340,height:80});
  g_pop.setContent("title","System");
  g_pop.setContent("alertCon",'<span style="font-size:12px; color:red">'+str+'</span>');
  g_pop.setContent("callBack",gotohome);
  g_pop.build();
  g_pop.show();	
}
function ShowInfoGom(str)
{
  g_pop=new Popup({ contentType:5,isReloadOnClose:false,width:340,height:80});
  g_pop.setContent("title","System");
  g_pop.setContent("alertCon",'<span style="font-size:12px; color:red">'+str+'</span>');
  g_pop.setContent("callBack",gotomc);
  g_pop.build();
  g_pop.show();	
}
function ShowInfoRe(str)
{
  g_pop=new Popup({ contentType:5,isReloadOnClose:false,width:340,height:80});
  g_pop.setContent("title","System");
  g_pop.setContent("alertCon",'<span style="font-size:12px; color:red">'+str+'</span>');
  g_pop.setContent("callBack",gotoreload);
  g_pop.build();
  g_pop.show();	
}
function ShowInfoPay(str,payurl)
{
  g_pop=new Popup({ contentType:55,isReloadOnClose:false,width:500,height:200});
  g_pop.setContent("title","Submit Order");
  g_pop.setContent("alertCon",'<span style="font-size:12px; color:#a98636;float:left">'+str+'</span>');
  g_pop.setContent("callBack",gotopay);
  g_pop.setContent("parameter",payurl);
  g_pop.build();
  g_pop.show();	
}
function ShowInfoNoPay(str)
{
  g_pop=new Popup({ contentType:55,isReloadOnClose:false,width:500,height:200});
  g_pop.setContent("title","Submit Order");
  g_pop.setContent("alertCon",'<span style="font-size:12px; color:#a98636;float:left">'+str+'</span>');
  g_pop.setContent("callBack",gotohome);
  g_pop.build();
  g_pop.show();	
}
function PostMember(str,ct)
{
  g_pop=new Popup({ contentType:3,isReloadOnClose:false,width:340,height:80});
  g_pop.setContent("title","System");
  g_pop.setContent("confirmCon",ct);
  g_pop.setContent("callBack",delCallback);
  g_pop.setContent("parameter",{fid:str,popup:g_pop});
  g_pop.build();
  g_pop.show();
  return false;
}

function Post(str)
{
  g_pop=new Popup({ contentType:3,isReloadOnClose:false,width:340,height:80});
  g_pop.setContent("title","System");
  g_pop.setContent("confirmCon","Whether can submit?");
  g_pop.setContent("callBack",delCallback);
  g_pop.setContent("parameter",{fid:str,popup:g_pop});
  g_pop.build();
  g_pop.show();
  return false;
}

function delCallback(para)
{
	var o_pop=para["popup"];
	o_pop.config.contentType=1;
	o_pop.setContent("contentUrl","");
	o_pop.reBuild();
	eval("document."+para["fid"]).target=o_pop.iframeIdName;
	eval("document."+para["fid"]).submit();
	return false;
}

function ShowHtmlString(str,strHtml,title,fun,ht) //显示html
 {
	 var pop=new Popup({ contentType:3,isReloadOnClose:false,width:510,height:ht});
	 pop.setContent("confirmCon",strHtml);
	 pop.setContent("title",title);
	 pop.setContent("callBack",fun);
     pop.build();
	 pop.show();
 }
function ShowViewForm(str,strHtml,title,ht) //显示html,查看表单
 {
	 var pop=new Popup({ contentType:6,isReloadOnClose:false,width:510,height:ht});
	 pop.setContent("confirmCon",strHtml);
	 pop.setContent("title",title);
     pop.build();
	 pop.show();
 }
function ShowViewForm2(str,strHtml,title,fun,id,ht) //显示html,提交表单
 {
	 var pop=new Popup({ contentType:66,isReloadOnClose:false,width:510,height:ht});
	 pop.setContent("confirmCon",strHtml);
	 pop.setContent("title",title);
	 pop.setContent("callBack",fun);
	 pop.setContent("parameter",id);
     pop.build();
	 pop.show();
 }
 
function gotohome()
{
	window.location.href='index.php';
}
function gotomc()
{
	window.location.href='index.php?task=membercenter';
}
function gotoreload()
{
	window.location.reload();
}
function gotopay(url)
{
	window.location.href=url;
}
