


function getframelayer(byname){
	//alert("Hi");
	/*
	If you use the SRC attribute in an iLayer, the maximum layers for this document is 2.
	Otherwise, it won't be able to find any nested layers beneath the item.
	*/
	if (document.layers){
		//alert('basta find frame');			

		//alert('Inside Layers Now');
		//advframes= 3;

		var curobj = document;
		var objects = new Array;
		var xstop = new Array;
		//alert(document.layers[0].layers);
		//return;
		for (var x = 0; x < curobj.layers.length; x++){
			//alert('Loop upto ' + curobj.layers.length);
			//alert(curobj.layers[x].name);
			if(curobj.layers[byname]){
				//alert('I have found ' + byname);
				return curobj.layers[byname];
			} else {
				//alert('I have not found ' + byname + ' at ' + curobj.layers[x].name + '. I am at current level ' + xstop.length);
				var nofurtherlayers = true;
					if((curobj.layers[x].document)&&(curobj.layers[x].document.layers)){
						//alert('How many sub layers does ' + curobj.layers[x].name + ' have? = ' + curobj.layers[x].document.layers.length);
						if(curobj.layers[x].document.layers.length >= 1){
							//alert('this one has a sub layer');
							tempobj = curobj;
							objects.push(tempobj);
							//alert('pushed objects, total now is ' + objects.length + ' total items of this is ' + tempobj.layers.length);
							xstop.push(x);
							//alert('pushed xstop at ' + x);
							curobj = curobj.layers[x].document;
							//alert(curobj.layers.length);
							x = -1;
							nofurtherlayers = false;
							//alert('Going back to loop at ' + x + ' and stopping at ' + curobj.layers.length);
						}//layer length is good
					}//
					if(nofurtherlayers){
						//alert('no further layers');
						//alert(objects.length);
						//alert(xstop.length)
						//alert(curobj.layers.length);
						//alert(x);
						//if(x >= curobj.layers.length){
							if ((objects.length >= 1)&&(xstop.length >= 1)){
								//alert('lets go back one level');
								curobj = objects.pop();
								//alert(curobj.layers.length);
								x = xstop.pop();
								//alert('start again at ' + x);
							}//
						//}//
					}//no further layers
			}//try to loop again
		}//end for each loop
		return null;
	} else if (document.getElementById(byname)){
		return document.getElementById(byname);
	} else if (document.frames[byname]) {
		return document.frames[byname];
	} else {
		advframes= 0;
		return null;
	}
}//endfunction

function resetframelayerheight(byname, vheight){
	var obj = getframelayer(byname);
	var hwidth;
	if(obj){
		if(document.layers){
			var objilayer = getframelayer(byname + "outer");
			hwidth = obj.clip.right;
			//alert(objilayer);
			//alert(hwidth);
			//obj.resizeTo(hwidth, vheight);
			//objilayer.resizeTo(hwidth, vheight);
		} else {
			//alert(obj.height);
			obj.height = vheight;
			//alert(obj.height);
		}//
	}//
}//endfunction


var nsloadevent = false;

function novooriginis(layername, theurl){
	var novobj = getframelayer(layername);
	//alert(document.layers[1].document.layers[0].name);
	if(novobj){
		if(document.layers){
			novobj.load(theurl, novobj.clip.width);
		} else {
			novobj.src = theurl;
		}
	}//end
}//end function