var MIN_HEIGHT = 640;
var MIN_WIDTH = 1100;

var fheight=0;
var fwidth=0;

var olduri="";
var intval=""
var download;
function flashResize() {
    resizeMin(MIN_WIDTH, fheight);
}
function setViewId(_vid, _uri,_title) {
	_title = unescape(_title);
	if (_title.indexOf("SieMatic")>-1) {
		document.title =_title;
		debug('Title '+_title);
  }	else {
		document.title ='SieMatic';
	}
  if (isDefined('xcmsSetEditorById'))
	   xcmsSetEditorById(_vid);
  var
   	element = document.getElementById('historyframe');
   
   if (element != null){
  		element.src='/historyframe.html?title='+_title;
   		debug('/historyframe.html?title='+_title);
   }
   if(olduri!=_uri) {
	if(window.location.host.indexOf("siematic.com")>-1){
		_uacct = "UA-5283814-1";
		urchinTracker(_uri);
		_uff = 0;_uacct = "UA-5283406-1";
		urchinTracker(_uri);
		_uff = 0;
		_uacct = "UA-1784462-1";
	        urchinTracker(_uri);
	} else {
		urchinTracker(_uri);
	}
    	olduri=_uri;
   }
}
function getUrl(_url) {
	document.getElementById('historyframe').src=_url;
}
function setIframe() {
		version=0
		if (navigator.appVersion.indexOf("MSIE")!=-1){
			temp=navigator.appVersion.split("MSIE");
			version=parseFloat(temp[1]);
		}
		if(version>0)
    	document.getElementById('historyframediv').innerHTML = "<iframe height=\"5\" id=\"historyframe\" name=\"historyframe\" src=\"/historyframe.html\" width=\"5\">&nbsp;</iframe>";
}
function flashresize(_height) {
	if (typeof _height != 'number'){
		error('illegal resize value in flashresize: '+_height);
		return;
	}
	_height = parseInt(_height);
	if (_height == 0)
		return;
	resizeMin(MIN_WIDTH, _height);
}
function resizeMin(_minWidth, _minHeight){
	//debug("minw: "+_minWidth+" minh:"+_minHeight+" currenth:"+fheight+" innerh:"+getInnerHeight());
	if (fheight != 0 && _minHeight < fheight && fheight < getInnerHeight())
		_minHeight = fheight;
		
	if (_minHeight < MIN_HEIGHT)
		_minHeight = MIN_HEIGHT;
	
	if (_minWidth < MIN_WIDTH)
		_minWidth = MIN_WIDTH;

	if (fwidth != _minWidth || fheight != _minHeight){
		fwidth = _minWidth;
		fheight = _minHeight+50;
		//debug("nw: "+fwidth+" nh:"+fheight);
		setElementSizeById("flash_movie", fwidth, fheight);
	}
}

setIframe();