var ScreenHeight, ScreenWidth, ScreenRes
var ScreenHeight = screen.height;
var ScreenWidth = screen.width;
var ie5 = (document.getElementById && document.all);
var ns6 = (document.getElementById && !document.all);
oRef = document.getElementById('dCMSMain');
if (ns6) { oRef.className = 'cms_main_nn'; }
function doCMSResize() {
	if(ie5) {
	    innerWidth = document.body.clientWidth;
	    innerHeight = document.body.clientHeight;
	}
	AvailHeight = innerHeight;
	objTop = parseInt(oRef.offsetTop);
	objHeight = parseInt(oRef.offsetHeight);
	objBase = parseInt(objTop + objHeight);
	
	oRightFill = document.getElementById('dRightFill');
	oLeftFill = document.getElementById('dLeftFill');
	if (objBase < AvailHeight) {
			if (ns6) {
				 oRef.style.height = AvailHeight - oRef.offsetTop;
				 oRightFill.style.height = AvailHeight - oRightFill.offsetTop + 20;
				 oLeftFill.style.height = AvailHeight - oLeftFill.offsetTop + 20;
			} else { 
				oRef.style.height = AvailHeight - oRef.offsetTop;
				oRightFill.style.height = AvailHeight - oRightFill.offsetTop;
				oLeftFill.style.height = AvailHeight - oLeftFill.offsetTop; 
			}
	} else { 
		if (ns6) {
			oRightFill.style.height = objBase - (oRightFill.offsetTop/2);
			oLeftFill.style.height = objBase - (oLeftFill.offsetTop/2) - 2;
		} else {
			oRightFill.style.height = objBase - oRightFill.offsetTop;
			oLeftFill.style.height = objBase - oLeftFill.offsetTop;		
		}
	}

}

function doResize(obj, dir) {
	if(ie5) {
	    innerWidth = document.body.clientWidth;
	    innerHeight = document.body.clientHeight;
	}
	hl = document.getElementById('HeadlineCont');
	
	o = document.getElementById(obj);
	AvailWidth = innerWidth;
	AvailHeight = innerHeight;
	objTop = o.offsetTop;
	objLeft = o.offsetLeft;
	if (dir == 0) {
		o.style.width = AvailWidth - objLeft;
	} else {
		if (hl.offsetHeight < AvailHeight) {
			if (objTop < AvailHeight) {
				o.style.height = AvailHeight - objTop;
				if ((ns6) && (o.id == 'dCMSMain')) {
					 o.style.height = AvailHeight - objTop - 20 
				} else {
					o.style.height = AvailHeight - objTop;
				}
			} else {
				o.style.height = '0%'; }
		} else {
			o.style.height = hl.offsetHeight;
		}
	}
	if ((ns6) && (o.id == 'dCMSMain')) {
		o.className = 'cms_main_nn';
	}
}
function doScrollResize(obj, dir) {
	if(ie5) {
	    innerWidth = document.body.clientWidth;
	    innerHeight = document.body.clientHeight;
	}
	hl = document.getElementById('HeadlineCont');
	o = document.getElementById(obj);
	AvailWidth = innerWidth;
	AvailHeight = innerHeight;
	objTop = o.offsetTop;
	objLeft = o.offsetLeft;
	if (dir == 0) {
		o.style.width = AvailWidth - o.style.posLeft + document.body.scrollRight;
	} else {
		if (objTop < AvailHeight) {
			if (document.body.scrollTop != 0) {
				o.style.height = AvailHeight - objTop + document.body.scrollTop; 
			} else {
				o.style.height = AvailHeight - objTop
			}
		} else {
			o.style.height = '0%'; }
	}

}
function doGenResize(obj, dir, pad) {
	if(ie5) {
	    innerWidth = document.body.clientWidth;
	    innerHeight = document.body.clientHeight;
	}
	o = document.getElementById(obj);
	b = document.body;
	AvailWidth = innerWidth;
	AvailHeight = innerHeight;
	bodyHeight = b.offsetHeight;
	bodyWidth = b.offsetHeight
	objTop = o.offsetTop;
	objLeft = o.offsetLeft;


	hl = document.getElementById('HeadlineCont');
	if (hl != null) {   
		HeadlineHeight = hl.offsetHeight;
		HeadlineWidth = hl.offsetWith;
		HeadlineTop = hl.offsetTop;
		if (HeadlineHeight < AvailHeight) {
			hl.style.height = AvailHeight - HeadlineTop - 200;
		}
	} else {
		HeadlineHeight = AvailHeight;
		HeadlineWidth = AvailWidth;
		HeadlineTop = objTop;
	}
	if (dir == 0) {
		o.style.width = AvailWidth - objLeft;
	} else {
		if (HeadlineHeight < AvailHeight) {
			if (objTop < AvailHeight) {
				o.style.height = AvailHeight - objTop;
				if ((ns6) && (o.id == 'dCMSMain')) {
					 o.style.height = AvailHeight - objTop - pad 
				} else {
					o.style.height = AvailHeight - objTop - pad;
				}
			} else {
				o.style.height = '0%'; }
		} else {
			o.style.height = HeadlineHeight;
		}
	}
	if ((ns6) && (o.id == 'dCMSMain')) {
		o.className = 'cms_main_nn';
	}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function SubmitBrandForm() {
	BrandSearchForm.submit();	
}
