﻿function ow(src,win_width,win_height,scbar)
{	
	var win=window.open(src,'view','width='+win_width+',height='+win_height+',resizable=no,scrollbars='+scbar+',status=no,toolbar=no,menubar=no,location=no');
	win.focus();
}
function ow2(src,win_width,win_height,scbar)
{	
	window.open(src,'','width='+win_width+',height='+win_height+',resizable=no,scrollbars='+scbar+',status=no,toolbar=no,menubar=no,location=no');
}
function fullwin(targeturl)
{
	window.open(targeturl,"","fullscreen,scrollbars=0")
}
////////////////////////////////////////////////////////////////
var imgObj;
var aNewWin;
function checkImg(theURL,winName){
  if (typeof(imgObj) == "object"){
    if ((imgObj.width != 0) && (imgObj.height != 0))
      OpenFullSizeWindow(theURL,winName, ",width=" + (imgObj.width+20) + ",height=" + (imgObj.height+30));
    else
      setTimeout("checkImg('" + theURL + "','" + winName + "')", 100)
  }
}
function OpenFullSizeWindow(theURL,winName,features) {
  var sBaseCmd;
  sBaseCmd = "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,left=0,top=0";
  if (features == null || features == ""){
    imgObj = new Image();
    imgObj.src = theURL;
    checkImg(theURL, winName);
  }
  else{
	if(typeof(aNewWin) == "object")	aNewWin.close();
    aNewWin = window.open(theURL,winName,sBaseCmd + features);
    aNewWin.focus();
  }
}
//////////////////////////////////////////////////////////////////////
	var initx = 0; //start position
	initx=0;
	var x = initx; 
	var y = 0;
	var limdex = 600; //一个周期的图片总宽度，过了这个宽度即跳现下一周期，from Iframe
	var dest = 0;
	var distance = 0;
	var step = 0;
	var destination = 0;
	var on = true;
	var speed=1;
	var tinterval=20;
	var timeoutvar;
function setmovespeed(i)
{
	speed=i;
}
function scrollit(destination) {
	step = 2;
	dest = destination;
	if (x<dest & x < limdex){
		while (x<dest) {
			step += (step / 2);
			x += step;
			document.frames.move.scroll(x,0);
		}  
		if(dest <=limdex) { document.frames.move.scroll(dest,0); }
		x = dest;
	}
	if (x > dest)  {
		while (x>dest) {
			step += (step / 2);
			if(x >= (0+step)) { x -= step; document.frames.move.scroll(x,0); }
			else break;
		}
		if(dest >= 0) { document.frames.move.scroll(dest,0); }
		x = dest;
	}
	if (x<1) { document.frames.move.scroll(1,0); x=1 }
	if (x>limdex) { document.frames.move.scroll(limdex,0); x=limdex }
	x = dest;
}
function scrollnow() 
{
	if (on){
		clearTimeout(timeoutvar);
		if (speed == 1 | speed == 0){
	         if (x < limdex * 2){              
	                document.frames.move.scroll(x,0);
	                x = x + speed ;
	         }
			 else x = initx;
			//else speed=-1;
	    }else if (speed == -1){
	         if ( x >= 0 ) {              
	                document.frames.move.scroll(x,0);
	                x = x + speed ;
	         }
			else  x = initx;
			 // else speed=1;
	     }      
		timeoutvar=setTimeout(scrollnow, tinterval);
      }
}
function stopscroll() {
	        if (on){
		        on = false;
			    scrollnow();
		    }
}
function startscroll() { on = true; scrollnow(); }

function stop_start() { 
	if (on) { on = false;}
	else { on = true;scrollnow();}
}
////////////////////////////////////////////////////////////
function getRedirect() {
	topsrc=document.location.href;
	if(topsrc.indexOf('?redirect=')!=-1) {
		var temp=topsrc.split("?redirect=")
		//alert(temp[1]);
		document.frames[0].location.href=temp[1];
		//document.frames[0].location.replace(temp[1]);
	}
}