﻿
//此处用来定义控制按钮 请根据自己页面的情况修改等号右边的内容为您相应按钮的id名称
//左边不要修改
var bt=new Array()

bt["cap"]="cap"; //拍摄按钮id
bt["about"]="about";//关于按钮id
bt["again"]="again";//重拍按钮id
bt["save"]="save";//上传保存按钮id
bt["rRight"]="rRight";
bt["rLeft"]="rLeft";
bt["mLeft"]="mLeft";
bt["mRight"]="mRight";
bt["mUp"]="mUp";
bt["mDown"]="mDown";
bt["zoomOut"]="zoomOut";
bt["zoomIn"]="zoomIn";
bt["delFrame"]="delFrame";
bt["trustSetting"]="trustSetting";
bt["about"]="about";
/*
	大头贴控制类 1.1
	您可以通过修改相应的类方法来实现对功能的控制扩展
	*/


	
	
	
	var start=false;
	
	//类块开始 BEGAIN
	
	 function  bigHead(Id){
	
		if (navigator.appName.indexOf("Microsoft") > -1) 
		{ 
				this.swfObj=window[Id]; 
			} else { 
				this.swfObj=document[Id]; 
		}
		
		this.Version="1.10";
		this.PoweredBy="TFOT";
		
	}
	
	//以下内容一般请不要修改(除非您了解其工作过程或对javascript比较熟悉)
	bigHead.prototype.changePic=function (url){if(start==true){this.swfObj.changePic(url)}}
	bigHead.prototype.initialBigHead=function(){this.swfObj.initialBigHead()}
	bigHead.prototype.capturePic=function(){if(start==true){this.swfObj.capturePic()}}
	bigHead.prototype.uploadPic=function(url) {if(start==true){grayAll();this.swfObj.uploadPic(url)}}
	bigHead.prototype.rotateRight=function(num) {if(start==true){this.swfObj.rotateRight(num)}}
	bigHead.prototype.rotateLeft=function(num) {if(start==true){this.swfObj.rotateLeft(num)}}
	bigHead.prototype.moveRight=function(num) {if(start==true){this.swfObj.moveRight(num)}}
	bigHead.prototype.moveLeft=function(num) {if(start==true){this.swfObj.moveLeft(num)}}
	bigHead.prototype.moveUp=function(num) {if(start==true){this.swfObj.moveUp(num)}}
	bigHead.prototype.moveDown=function(num) {if(start==true){this.swfObj.moveDown(num)}}
	bigHead.prototype.zoomOut=function(num) {if(start==true){this.swfObj.zoomOut(num)}}
	bigHead.prototype.zoomIn=function(num) {if(start==true){this.swfObj.zoomIn(num)}}
	bigHead.prototype.delFrame=function() {if(start==true){this.swfObj.delFrame()}}
	bigHead.prototype.reStart=function(){if(start==true){this.swfObj.reStart()}}
	bigHead.prototype.setBox=function(num1,num2){
		
			if(start==true){this.swfObj.setBox(num1,num2)}
	}
	bigHead.prototype.showVersion=function(){
		
			this.swfObj.showVersion();//开源版本中此功能已经去除
	}
	
	bigHead.prototype.trustSetting=function(){
		
			this.swfObj.trustSetting();
	}
	
	
	//类块结束 END
	
	function getObj(id){return document.getElementById(id)}
	
	//普通函数开始(此处的函数用于Flash的回调,请自己定义相关函数代码块)
	
	
	
	function uploadOk(fileurl){
		if(confirm("图片上传成功是否查看")){location.href=fileurl;}
		dt.reStart()
		
	}
	
	
	function cameraOk(){
 		start=true;
		setNor("cap");
		setGray("save");
		setGray("again");
		setGray("rRight");
		setGray("rLeft");
		setGray("mUp");
		setGray("mDown");
		setGray("mRight");
		setGray("mLeft");
		setGray("zoomOut");
		setGray("zoomIn");
		setNor("delFrame");

	}
	
	//将按钮设置为无效
	function grayAll(){
		
		setGray("cap");
		setGray("save");
		setGray("again");
		setGray("rRight");
		setGray("rLeft");
		setGray("mUp");
		setGray("mDown");
		setGray("mRight");
		setGray("mLeft");
		setGray("zoomOut");
		setGray("zoomIn");
		setGray("delFrame");
	}
	
	function cameraFail(){
   		start=false;
		setGray("cap");
		setGray("save");
		setGray("again");
		setGray("rRight");
		setGray("rLeft");
		setGray("mUp");
		setGray("mDown");
		setGray("mRight");
		setGray("mLeft");
		setGray("zoomOut");
		setGray("zoomIn");
		setGray("delFrame");
		alert("没有检测到可用摄像头");
		
  		
	}
	function uploadFail(Errinfo)
	{
		alert("上传失败啊");
		
 
	}

	function captureOk()
	{
 
		setGray("cap")
	    setNor("save");
		setNor("again");
		setNor("rRight");
		setNor("rLeft");
		setNor("mUp");
		setNor("mDown");
		setNor("mRight");
		setNor("mLeft");
		setNor("zoomOut");
		setNor("zoomIn");
		setNor("delFrame");
		alert("现在可以上传了(点击上传后请稍等一会,将视网络速度而定)")
 
	}
	//设置相应id元素为不可用状态
	function setGray(id)
	{
	getObj(bt[id]).style.filter='alpha(opacity=30) gray';
	getObj(bt[id]).disabled=true;
	}
	//设置相应id元素为正常状态
	function setNor(id)
	{
		getObj(bt[id]).disabled=false;
		getObj(bt[id]).style.filter='';
	}
	
	
var dt=new Object() ;//注意此处的dt 最好不要修改,如要改动请对应的修改此文件中的dt 和 显示页面body onload中的dt




