function frameloader(pFrameset_s) {
	if(frameloader.arguments.length > 1) {
		// create frameset url parameter
		var urlStr='';
		for(i=1;i<frameloader.arguments.length-1;i+=2) {
			i>1 ? urlStr = urlStr+'&' : urlStr = urlStr;
			urlStr = urlStr+frameloader.arguments[i]+'='+frameloader.arguments[i+1];
		}
		urlStr != '' ? pFrameset_s = pFrameset_s+'?'+urlStr : pFrameset_s = pFrameset_s;
	}
	
	// load frameset if there is none
	if(parent.frames.length == 0) window.location.replace(pFrameset_s);
	// otherwise check files in the frames
	else {
		var corrFrameSet = true;
		if(frameloader.arguments.length > 1) {
			// check if all frames exists
			for(i=1;i<frameloader.arguments.length-1;i+=2) {
				if(!eval('parent.frames.'+frameloader.arguments[i])) corrFrameSet = false;
			}
			if(!corrFrameSet) parent.location.replace(pFrameset_s);
			
			// check if correct files are lodaded and load correct if not
			for(i=1;i<frameloader.arguments.length-1;i+=2) {
				if(eval('parent.frames.'+frameloader.arguments[i])) {
					tmpFrameObj = eval('parent.frames.'+frameloader.arguments[i]);
					tmpFrameSrc = tmpFrameObj.location.toString();
					file1Arr = tmpFrameSrc.split("/");
					file2Arr = frameloader.arguments[i+1].split("/");
					if(file1Arr[file1Arr.length-1] != file2Arr[file2Arr.length-1]) tmpFrameObj.location = frameloader.arguments[i+1];
				}
			}
		}
	}
}

function frameSetLoader() {
	thisURL = window.document.location.href;
	if(thisURL.indexOf("?") != -1) {
		urlArr = thisURL.split("?");
		if(urlArr.length > 1) {
			paramArr = urlArr[1].split("&");
			for(i=0;i<paramArr.length;i++) {
				paramContArr = paramArr[i].split("=");
				tempFrameObj = eval('frames.'+paramContArr[0]);
				if(tempFrameObj) {
					tempFrameSrc = tempFrameObj.location.toString();
					file1Arr = tempFrameSrc.split("/");
					file2Arr = paramContArr[1].split("/");
					if(file1Arr != file2Arr) tempFrameObj.location = paramContArr[1];
				}
			}
		}
	}
}

