var client = new Browser();

function Browser() {
	this.opera		=	false;
	this.mie		=	false;
	this.net6		=	false;
	this.net4		=	false;
	this.mozilla	=	false;
	this.icab		=	false;
	this.version	=	0;
	this.win		=	false;
	this.mac		=	false;
	if (navigator.userAgent.indexOf("iCab") != -1) {
		this.icab = true;
		this.version = navigator.userAgent.substr(navigator.userAgent.indexOf("iCab") +5 ,3);
	} else if (navigator.userAgent.indexOf("Opera") != -1) {
		this.opera = true;
		this.version = navigator.userAgent.substr(navigator.userAgent.indexOf("Opera") +6 ,3);
	} else if (navigator.appName.indexOf("Netscape") != -1) {
		if (navigator.userAgent.indexOf("Gecko") != -1) {
			if (navigator.userAgent.indexOf("Netscape6") != -1) {
				this.net6 = true;
				this.version = navigator.userAgent.substr(navigator.userAgent.indexOf("Netscape6") +10 ,3);
			} else {
				this.mozilla = true;
				this.version = navigator.userAgent.substr(navigator.userAgent.indexOf("rv:") +3 ,5);
			}
		} else {
			this.net4 = true;
			this.version = navigator.appVersion.substr(0,3);
		}
	} else if (navigator.userAgent.indexOf("MSIE") != -1) {
		this.mie = true;
		this.version = navigator.userAgent.substr(navigator.userAgent.indexOf("MSIE") +5 ,3);
	} 
	if (navigator.platform.indexOf("Mac") != -1) {
		this.mac = true;
	} else if (navigator.platform.indexOf("Win") != -1) {
		this.win = true;
	}
}
function blurLink(obj) {
	if ((client.mie) || (client.net6) || (client.mozilla)) {
		obj.blur();
	}
}

function highMenuItem(menuObj, indentMenuObj, contentMenuObj, textObj, intType) {
	// <td> bgColor
	eval(menuObj).style.backgroundColor='#003399';
	eval(indentMenuObj).style.backgroundColor='#003399';
	eval(contentMenuObj).style.backgroundColor='#003399';
	// For MIE Cursor
	eval(menuObj).style.cursor='hand';
	eval(indentMenuObj).style.cursor='hand';
	eval(contentMenuObj).style.cursor='hand';
	if (document.all) {
	// MIE
		document.all[textObj].style.color='#FFFFFF';
	} else if (document.getElementById) {
	// Netscape 5(6)
		document.getElementById(textObj).style.color='#FFFFFF';
	}
}

function resetMenuItem(menuObj, indentMenuObj, contentMenuObj, textObj, intType) {
	if (intType==1) {
		eval(menuObj).style.backgroundColor='#7790C3';
		eval(indentMenuObj).style.backgroundColor='#7790C3';
		eval(contentMenuObj).style.backgroundColor='#7790C3';
		if (document.all) {
		// MIE
			document.all[textObj].style.color='#FFFFFF';
		} else if (document.getElementById) {
		// Netscape 5(6)
			document.getElementById(textObj).style.color='#FFFFFF';
		}
	} else if (intType==2) {
		eval(menuObj).style.backgroundColor='#CCD6EB';
		eval(indentMenuObj).style.backgroundColor='#CCD6EB';
		eval(contentMenuObj).style.backgroundColor='#CCD6EB';
		if (document.all) {
		// MIE
			document.all[textObj].style.color='#003399';
		} else if (document.getElementById) {
		// Netscape 5(6)
			document.getElementById(textObj).style.color='#003399';
		}
	} else {
		eval(menuObj).style.backgroundColor='#FFFFFF';
		eval(indentMenuObj).style.backgroundColor='#FFFFFF';
		eval(contentMenuObj).style.backgroundColor='#FFFFFF';
		if (document.all) {
		// MIE
			document.all[textObj].style.color='#003399';
		} else if (document.getElementById) {
		// Netscape 5(6)
			document.getElementById(textObj).style.color='#003399';
		}		
	}
}

function imageSwapObj(imgNameStr, outSrc, overSrc, clickSrc, imgGrp) {
	// Bild Name
	this.imgName = imgNameStr;
	// Bild Objekt
	this.object = window.document.images[this.imgName];
	// Over Bild
	this.overImg = new Image();
	this.overImg.src = overSrc;
	// Out Bild
	this.outImg = new Image();
	this.outImg.src = outSrc;
	// Click Bild
	if (clickSrc != '') {
		this.clickImg = new Image();
		this.clickImg.src = clickSrc;
	}
	this.isClicked = false;
	// Image Gruppe
	this.imgGrp = imgGrp;
	// Bild Gruppen
	if (imgGrp != '') {
		this.grpObjs = imgGrp.imgObjs;
	}
	this.over = function() {
		if (this.isClicked == false) {
			this.object.src = this.overImg.src;
		}
	}
	this.out = function() {
		if (this.isClicked == false) {
			this.object.src = this.outImg.src;
		}
	}
	this.click = function() {
		if (clickSrc != '') {
			if (this.isClicked == false) {
				this.object.src = this.clickImg.src;
				this.isClicked = true;
			} else {
				this.object.src = this.overImg.src;
				this.isClicked = false;
			}
			if(this.imgGrp != '') {
				for (i = 0; i < this.grpObjs.length; i++) {
					nameStr = eval(this.grpObjs[i] + ".imgName")
					if (nameStr != this.imgName) {
						eval(this.grpObjs[i] + ".isClicked = false");
						eval(this.grpObjs[i] + ".out();");
					}
				}

			}
		}
	}
}

function initWin(name, url, width, height, scroll, resizable, status, center) {
	this.name = name;
	this.url = url;
	this.width = width;
	this.height = height;
	this.top = (center == 1) ? (screen.height-this.height)/2 : 0;
	this.left = (center == 1) ? (screen.width-this.width)/2 : 0;
	this.scroll = scroll;
	this.resizable = resizable;
	this.status = status;
	this.center = center;
	this.winOpen = function(strQuery) {
		this.win = window.open(this.url + '?' + strQuery, this.name, 'height=' + this.height + ',width=' + this.width + ',locationbar=no,menubar=no,toolbar=no,scrollbars=' + this.scroll + ',resizable=' + this.resizable + ',top=' + this.top + ',left=' + this.left + ',status=' + this.status);	
	}
	this.winClose = function() {
		this.win.close();	
	}
}

function initSprint3PlusWin(url) {
	this.name = "sprint3Plus";
	this.url = url;
	this.winOpen = function() {
		this.win = window.open(this.url, this.name);
		this.win.focus();
	}
	this.winClose = function() {
		this.win.close();	
	}
}

function importFldFromOpener(fromFormName, fromFldName_1, fromFldName_2, fromFldName_3, toFormName, toFldName_1, toFldName_2, toFldName_3) {

	document.forms[toFormName].elements[toFldName_1].value = opener.document.forms[fromFormName].elements[fromFldName_1].value;
	document.forms[toFormName].elements[toFldName_2].value = opener.document.forms[fromFormName].elements[fromFldName_2].value;
	if(opener.document.forms[fromFormName].elements[fromFldName_3].value == "true") {
		document.forms[toFormName].elements[toFldName_3].checked = true;
	}
	
}

function exportFldToOpener(fromFormName, fromFldName_1, fromFldName_2, fromFldName_3, toFormName, toFldName_1, toFldName_2, toFldName_3) {

	opener.document.forms[toFormName].elements[toFldName_1].value = document.forms[fromFormName].elements[fromFldName_1].value;
	opener.document.forms[toFormName].elements[toFldName_2].value = document.forms[fromFormName].elements[fromFldName_2].value;
	if(document.forms[fromFormName].elements[fromFldName_3].checked) {
		 opener.document.forms[toFormName].elements[toFldName_3].value = "true";
	} else {
		opener.document.forms[toFormName].elements[toFldName_3].value = "";
	}
}

function initWinSize(c) {
	window.focus();
	if (document.picture.complete == true) {
		if (c == true) {
			extraHeight = 175;
		}
		else {
			extraHeight = 75;
		}
		var newWidth = document.picture.width + 30;
		var newHeight = document.picture.height + extraHeight;
		if (((screen.height / 2) - newHeight) > screen.height) {
			window.moveTo(10,10);
		} else {
			window.moveTo((screen.width-newWidth)/2,(screen.height-newHeight)/2);
		}
		window.resizeTo(newWidth,newHeight);
	}
	else {
		window.setTimeout("initWinSize()",60);
	}
}

var pictureWin = new initWin('sprint3PicViewer', 'kernel_sales_images_actualDisplay_popUp.asp' ,400, 400, 'no', 'no', 'yes', true);
var pictureAdminWin = new initWin('sprint3AdminPicViewer', 'kernel_admin_images_actualDisplay_popUp.asp' ,400, 400, 'no', 'no', 'yes', true);
var commentWin = new initWin('sprint3OrderLineComment', 'kernel_sales_stocklist_orderLineComment_popUp.asp' ,400, 400, 'no', 'no', 'yes', true);
var currentCommentWin = new initWin('sprint3CurrentOrderLineComment', 'kernel_sales_orders_currentOrderLineComment_popUp.asp' ,400, 400, 'no', 'no', 'yes', true);
var archivedCommentWin = new initWin('sprint3ArchivedOrderLineComment', 'kernel_sales_orders_archivedOrderLineComment_popUp.asp', 400, 400, 'no', 'no', 'yes', true);
var extraInformationWin = new initWin('sprint3ExtraInformation', 'kernel_sales_stocklist_extraInformation_popUp.asp', 600, 400, 'yes', 'no', 'yes', true);
var holdingsWin = new initWin('sprint3Holdings', 'kernel_sales_stocklist_holdings_popUp.asp', 400, 400, 'yes', 'no', 'yes', true);
var noteWin = new initWin('sprint3WriteNote', 'kernel_sales_contact_noteWrite_popUp.asp' ,400, 445, 'no', 'yes', 'yes', true);
var sprint3PlusWin = new initSprint3PlusWin('kernel_sprint3Plus_redirect.asp');

