//class Resize
function Resize(){
}//end function

Resize.prototype.init=function Resize_init(q_MENUSTRIP,q_SLIDE,q_INTERACTION){
this.q_MENUSTRIP=q_MENUSTRIP;
this.q_SLIDE=q_SLIDE;
this.q_INTERACTION=q_INTERACTION;
this.isFlipped="0";
this.q_FORM=this.readCoords();
}//end function

Resize.prototype.readCoords=function Resize_readCoords(){
var q_form=new Array();
//list layer objects
var divs = document.getElementsByTagName("DIV");
for(var q_ix=0;q_ix<divs.length;q_ix++){
	if(this.q_isRelevantObject(divs[q_ix].id)){
		q_form[q_form.length]=this.q_getObjectCoords(divs[q_ix]);
	}//end if
}//next
var divs = document.getElementsByTagName("SPAN");
for(var q_ix=0;q_ix<divs.length;q_ix++){
	if(this.q_isRelevantObject(divs[q_ix].id)){
		q_form[q_form.length]=this.q_getObjectCoords(divs[q_ix]);
	}//end if
}//next
var divs = document.getElementsByTagName("A");
for(var q_ix=0;q_ix<divs.length;q_ix++){
	if(this.q_isRelevantObject(divs[q_ix].id)){
		q_form[q_form.length]=this.q_getObjectCoords(divs[q_ix]);
	}//end if
}//next
return q_form;
}//end function

//public
Resize.prototype.setCoord=function Resize_setCoord(idname,q_rec){
for(var q_ix=0;q_ix<this.q_FORM.length;q_ix++){
if(this.q_FORM[q_ix][0]==idname){
	this.q_FORM[q_ix]=q_rec;
	return true;
}//end if
}//next
return false;
}//end method

//Private method
Resize.prototype.q_isRelevantObject=function (q_id){
if(q_id>""){
	return ((",servcom,stat,resize,preload,Notes,MenustripGraphic,Menustrip_pynt,Menustrip_menu,Roller,action," ).indexOf(","+q_id+",")==-1);
}else{
	return false;
}//end if
}//end function

Resize.prototype.q_getObjectCoords=function (d){
if(d.style.fontSize){
	return new Array(d.id,d.style.visibility,d.offsetLeft,d.offsetTop,d.offsetWidth,d.offsetHeight,parseInt(d.style.fontSize));
}else{
	return new Array(d.id,d.style.visibility,d.offsetLeft,d.offsetTop,d.offsetWidth,d.offsetHeight,null);
}//end if
}//end function

Resize.prototype.resizeForm=function Resize_resizeForm(){
	var q_master=this.getCoords("master");
	var	q_xscale=windowWidth()/q_master[4];
	if(this.q_MENUSTRIP){
		var q_yscale=(windowHeight()-20)/q_master[5];
	}else{
		var q_yscale=windowHeight()/q_master[5];
	}//end if
	var	q_scale=Math.min(q_xscale,q_yscale);
	this.myScale=q_scale;
	this.resizeDivs(q_scale);
	resetYellowmessage();
	this.q_adjustQuicktimeSize();
	if(this.q_MENUSTRIP){
		this.q_MENUSTRIP.resize(q_scale*this.getCoords("master")[4],q_scale);
	}//end if
	if(this.q_SLIDE){
		var q_slideCoords=this.getCoords("slide");
		this.q_SLIDE.resize(q_scale*q_slideCoords[4],q_scale*q_slideCoords[5]);
	}//end if
	if(this.q_INTERACTION){
		this.q_INTERACTION.resize(q_scale);
	}//end if
}//end function

Resize.prototype.getCoords=function (q_id){
for(q_ix=0;q_ix<this.q_FORM.length;q_ix++){
	if(this.q_FORM[q_ix][0]==q_id){
		return this.q_FORM[q_ix];
	}//end if
}//next
return null;
}//end function

Resize.prototype.resizeDivs=function Resize_resizeDivs(q_scale){
for(q_ix=0;q_ix<this.q_FORM.length;q_ix++){
try{
	this.q_setLayer(this.q_FORM[q_ix][0],this.q_FORM[q_ix],q_scale);
}catch(errObj){
logga(errObj.description);
}//end catch
}//next
}//end function

Resize.prototype.q_setLayer=function (q_id,q_coords,q_scale){
try{
this.q_setObjectStyle(q_id+"img",q_coords,q_scale);
this.q_setObjectStyle(q_id,q_coords,q_scale);
}catch(errObj){
logga("q_setLayer("+q_id+",q_coords,"+q_scale+") "+errObj.description);
}//end catch
}//end function

Resize.prototype.q_setObjectStyle=function (q_id,q_coords,q_scale){
if(div(q_id)){
	if(q_coords){
		if(q_scale){
			if(q_scale>0 && q_scale<10.0){
				return this.q_scaleObjectStyle(q_id,q_coords,q_scale);
			}else{
				return this.q_scaleObjectStyle(q_id,q_coords,1.0);
			}//end if
		}else{
			return this.q_scaleObjectStyle(q_id,q_coords,1.0);
		}//end if
	}//end if
}//end if
}//end function

Resize.prototype.q_scaleObjectStyle=function (q_id,q_coords,q_scale){
var q_layerstyle=div(q_id).style;
if(q_id=="videoimg"){
	div(q_id).width=q_coords[4];
	div(q_id).height=q_coords[5];
	if(WIN()&&FX()){
		setTimeout("repeatVideoSize()",500);//Workaround for Firefox resize bug
	}//end if
}//end if
q_layerstyle.width=q_scale * q_coords[4];
q_layerstyle.height=q_scale * q_coords[5];
if(!endswith(q_id,"img")){
	q_layerstyle.left=q_scale * q_coords[2];
	q_layerstyle.top=q_scale * q_coords[3];
}//end if
if(q_coords[6]){
   q_layerstyle.fontSize=q_scale * q_coords[6];
}//end if
}//end function

function repeatVideoSize(){
	logga("repeatVideoSize");
	div("videoimg").style.width=div("video").offsetWidth;
	div("videoimg").style.height=div("video").offseHeight;
}//end function

Resize.prototype.flip=function Resize_flip(q_mode){
//q_mode "0" is normal, "1" is flipped
if(q_mode){
}else{
	q_mode=(this.isFlipped=="1")?"0":"1";
}//end if
if(this.isFlipped!=q_mode){
	if(q_mode=="0"||q_mode=="normal"||q_mode=="flipback"){
		this.q_setLayer("video",this.getCoords("video"));
		this.q_setLayer("slide",this.getCoords("slide"));
		this.isFlipped="0";
	}else{
		this.q_setLayer("video",this.getCoords("slide"));
		this.q_setLayer("slide",this.getCoords("video"));
		this.isFlipped="1";
	}//end if
	this.q_adjustQuicktimeSize();
}//end if
}//end function

//Private method
Resize.prototype.q_adjustQuicktimeSize=function (){
try{
var q_v=div("videoimg");
	if(q_v.SetRectangle){
		//q_v.SetRectangle("0,0,"+parseInt(document.getElementById("video").style.width)+ ","+parseInt(document.getElementById("video").style.height));
		q_v.SetRectangle("0,0,"+div("video").offsetWidth+ ","+div("video").offsetHeight);
	}//end if
}catch(errObj){
}//end catch
}//end function

//end class Resize