
/**
 * 电话号码验证
 */
String.prototype.Trim = function() {  
	  var m = this.match(/^\s*(\S+(\s+\S+)*)\s*$/);  
	  return (m == null) ? "" : m[1];  
	}

	String.prototype.isMobile = function() {  
	  return (/^(?:13\d|15[89])-?\d{5}(\d{3}|\*{3})$/.test(this.Trim()));  
	} 
	String.prototype.isTel = function()
	{
	    return (/^(([0\+]\d{2,3}-)?(0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/.test(this.Trim()));
	}
	
 function checkIsFloat(){   
          var   nc=event.keyCode;   
          if((nc>=48)   &&   (nc<=57)   ){   
          }else   if(nc==46){   
          var   s=document.form1.ammeterData.value;
              for(var   i=0;i<s.length;i++){   
                  if(s.charAt(i)=='.'){   
                              event.keyCode=0;   return;   
                  }   
              }   
          }else{   
              event.keyCode=0;return;   
          }   
      }   

/**
 * 控制投票选项
 */	
function inquiryOption(a,b,c){
	
  if(a==-10000&&b==-10000){
  	alert("无法投票！");
  	return false;
  }

	var choose = document.getElementsByName("choose");
	var selectedIndex = -1;
	var i = 0;
	var j = 0;
    var optionValue = new Array();
    for (i=0; i<choose.length; i++)
    {
        if (choose[i].checked)
        {
            selectedIndex = i;
         	optionValue[j] = choose[i].value;
         	j++;
        }
    }
	if(selectedIndex < 0){
		alert("请选择你要投票的选项！");
		return false;
	}else{
		if(c=="gc"){
			window.open('inquiry_gc.htm?titleId='+a+'&optionId='+optionValue+'&type='+b);
		}else{
			window.open('inquiry.htm?titleId='+a+'&optionId='+optionValue+'&type='+b);
		}
		
	}
	
}

function showFlashWindow(){

	var pics= document.getElementById("picsHidden").value;

    var links= document.getElementById("linksHidden").value;
	var texts= document.getElementById("titlesHidden").value;
    var focus_width=149;//
    var focus_height=99;//
    var text_height=24;//
    var swf_height = focus_height+text_height;
    var fv="pics="+pics+"&links="+links+"&texts="+texts+"&borderwidth="+focus_width+"&borderheight="+focus_height+"&textheight="+text_height;
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="'+focus_width+'" height="'+swf_height+'">');
	document.write('<param name="movie" value="main/images/pv.swf"> <param name="quality" value="high"><param name="allowScriptAccess" value="sameDomain"><param name="menu" value="false"><param name="bgcolor" value="#ffffff"><param name="wmode" value="opaque">');
	document.write('<param name="flashvars" value="'+fv+'">');
    document.write('<embed src="main/images/pv.swf" wmode="opaque" FlashVars="'+fv+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#ffffff" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');  
	document.write('</object>');

}
function showFlashWindow1(){

	var pics= document.getElementById("picsHidden1").value;
    var links= document.getElementById("linksHidden1").value;
	var texts= document.getElementById("titlesHidden1").value;
    var focus_width=149;//
    var focus_height=99;//
    var text_height=24;//
    var swf_height = focus_height+text_height;
    var fv="pics="+pics+"&links="+links+"&texts="+texts+"&borderwidth="+focus_width+"&borderheight="+focus_height+"&textheight="+text_height;
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="'+focus_width+'" height="'+swf_height+'">');
	document.write('<param name="movie" value="main/images/pv.swf"> <param name="quality" value="high"><param name="allowScriptAccess" value="sameDomain"><param name="menu" value="false"><param name="bgcolor" value="#ffffff"><param name="wmode" value="opaque">');
	document.write('<param name="flashvars" value="'+fv+'">');
    document.write('<embed src="main/images/pv.swf" wmode="opaque" FlashVars="'+fv+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#ffffff" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');  
	document.write('</object>');

}
