/*
	*2009/1/4 增加prototype版检查功能！
*/
if (DEPLOY_MODE=='undefined'){//调适模式和部署模式怎么区分
	var DEPLOY_MODE=true
}

var mbDocument= {
	Version: '1.0.0.1',
	REQUIRED_PROTOTYPE: '1.6.0',
	ICONURL:'http://vote.pctutu.net/v11/static/images/upload/',
	      TASKSOFTIDS:'',//任务列表的所有id
        DRIVEIDS: new Array(),//驱动所有id
        SOFTS: new Array(),//软件所有id
        DRIVESNOW_TOTAL: 0,//驱动现在操作个数
	AllowDownCount:5,
	_debug:1,
	load: function() {
		function convertVersionString(versionString){
		  var r = versionString.split('.');
		  return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
		}

		if((typeof Prototype=='undefined') || (typeof Element == 'undefined') ||  (typeof Element.Methods=='undefined') ||  (convertVersionString(Prototype.Version) < convertVersionString(mbDocument.REQUIRED_PROTOTYPE)))
		   throw("mbDocument requires the Prototype JavaScript framework >= " + mbDocument.REQUIRED_PROTOTYPE);

	},
	tip:function(obj,str){
		infoobj=obj.up(0).select("SPAN.info")[0];
		if (obj.tagName=='INPUT') obj.activate();
		if (infoobj){
			if (str!=''){
				infoobj.update(str);
				infoobj.className='info';
				infoobj.addClassName('warning');
			}else{
				infoobj.update('OK');
				infoobj.className='info';
                infoobj.addClassName('Success');
			}
		}
	},
	SetDebuger:function(_debuge){
		this._debug = _debuge;
		if(_debuge == 0)
		{
			$('dbg_nav').hide();
		} else {
			$('dbg_nav').show();
		}
	},
        page_tabswicth:function(num){
            var page=new Array('showdevice','downloadsetup','drivernone');
            for(var i=0;i<page.length;i++){
                if(page[i]==num){
                   $(page[i]).show();
                }else{
                   $(page[i]).hide();
                }
            }
        },
        //提交驱动选中
        submit_drive:function(){
               var cids=new Array();
               cids=this.DRIVEIDS;               
               var cidstr="";
               for(var i=0;i<cids.length;i++){
                   if($(cids[i]).value=='1' ){
                       cidstr+=","+cids[i];
                   }
               }
               if(this._debug == 1) {
                        alert(cidstr.substring(1));
                   } else {
                        return cidstr.substring(1);
               }
        },
	btnStatus:function(){
		$A($$('img.btn')).each(function(img){

			var perName=img.src.substr(img.src.length-3,3);
			var sourceName=img.src.replace('_1.'+perName,'.'+perName).replace('_2.'+perName,'.'+perName)
			img.onmouseover=function(){
				img.src=sourceName.replace('.'+perName,'_1.'+perName);
			}
			img.onmouseout=function(){
				img.src=sourceName
			}
			img.onclick=function(){
				img.src=sourceName.replace('.'+perName,'_2.'+perName);
				img.src=sourceName.replace('.'+perName,'_1.'+perName);
			}
		});

	},
        downprogress:function(item,percentage,speed){//下载提交
                $(item+'_1').show();
                $(item+'_2').show();
                $(item+'_percentage1').style.width=percentage+'%';
                $(item+'_percentage2').innerHTML=percentage+'%';
                $(item+'_speed').innerHTML=speed+' KB/S';
        },
        setupprogress:function(item,status){//安装提交
                $('driversetup').show();
                if(status=='0'){
                   $('driversetup').innerHTML=item+"： <img src='images/loading.gif' width='20' height='20'  style='vertical-align:middle;margin-left:5px;'>";
				   $('konwscores').hide();
                }else{
                   $('driversetup').innerHTML=item;
				   $('konwscores').show();
                }
        },
        assignDname:function(dname){//设备赋值
               $('showdevice_dname').innerHTML=dname;
               $('downloadsetup_dname').innerHTML=dname;
        },
        driveSubmit:function(){
               var brand=$('brand').value;
               var model=$('model').value;
               //alert(brand+'|'+model+'|'+imei);
		window.location.href='http://ExecCmd=SendtoMe;brand=' + brand + ';model=' + model + ';';
        },
        writescore:function(cpuMax,sint,sfloat,mem,sdb,s2d,s3d,readSD,writeSD,score,picurl){//璁惧璧嬪�
               $('cpuMax').innerHTML=cpuMax;
               $('sint').innerHTML=sint;
               $('sfloat').innerHTML=sfloat;
               $('mem').innerHTML=mem;
               $('sdb').innerHTML=sdb;
               $('s2d').innerHTML=s2d;
               $('s3d').innerHTML=s3d;
               $('readSD').innerHTML=readSD;
               $('writeSD').innerHTML=writeSD;
               $('score').innerHTML=score;
               if(picurl.indexOf('.jpg')==-1){
                 $('mobile_pic').innerHTML='<img width="133" height="215" id="modelpic" src="images/mobile.png.jpg">';
               }else{
                 $('mobile_pic').innerHTML='<div style="background:url('+picurl+') -46px 0px;" class="mobile_par"></div>';
               }
               
        },
        submitSuc:function(){//提交成功
               $('submitSuc').show();
        }

}
mbDocument.load();

document.oncontextmenu=new Function("event.returnValue=false;");
document.onselectstart=new Function("event.returnValue=false;");
