/*
Title: ykb_PopUpWindow.js
Version: 2.25
Author: Dale Couch (DC)
Copyright Channel Intelligence, Inc. 2002-2004
*/
function ykb_popupWindow_version() { return '2.30'; }
function manu_CDLink(rsCustomer,rsSKU,nHeight,nWidth,rbFullChrome,rsClientTag,rbShowMenu,rnSCID,rsAName) {
	oWin = ykb_PopUp('cii_com_' + Math.round(Math.random() * 1000), rsCustomer, 'http://' + rsCustomer + '.links.channelintelligence.com/pages/prices.asp?' + (rnSCID ? 'nSCID=' + rnSCID + '&' : '') + 'sSKU=' + escape(rsSKU).replace('+','%2B') + (rsClientTag ? '&sCT=' + escape(rsClientTag).replace('+','%2B') : '') + (rsAName ? '&sAName=' + escape(rsAName).replace('+','%2B') : ''), (nHeight && nHeight != '' ? nHeight : '430'), (nWidth && nWidth != '' ? nWidth : '800'), 'middle', 'center', true, (rbFullChrome ? 'browser' : ''), true, true, true, (rbShowMenu ? 'true' : 'false'));
	oWin.focus();
}
function manu_CDLinkNoURL(rsCustomer,rsSKU,nHeight,nWidth,rsClientTag,rnSCID) {
	manu_CDLink(rsCustomer,rsSKU,nHeight,nWidth,false,rsClientTag,true,rnSCID);
}
function manu_CDLinkFullChrome(rsCustomer,rsSKU,nHeight,nWidth,rsClientTag,rnSCID) {
	manu_CDLink(rsCustomer,rsSKU,nHeight,nWidth,true,rsClientTag,rnSCID);
}
function manu_CDLinkMinimal(rsCustomer,rsSKU,nHeight,nWidth,rsClientTag,rnSCID) {
	oWin = ykb_PopUp('cii_com_' + Math.round(Math.random() * 1000), rsCustomer, 'http://' + rsCustomer + '.links.channelintelligence.com/pages/prices.asp?' + (rnSCID ? 'nSCID=' + rnSCID + '&' : '') + 'sSKU=' + escape(rsSKU).replace('+','%2B') + (rsClientTag ? '&sCT=' + escape(rsClientTag).replace('+','%2B') : ''), (nHeight && nHeight != '' ? nHeight : '430'), (nWidth && nWidth != '' ? nWidth : '800'), 'middle', 'center', true, '', true, false, false, false, false);
	oWin.focus();
}
function manu_Purchase(rsCustomer,rsSKU,rnVendorID,rsClientTag,rbICI,rnCTID,rnSCID) {
	if (!rnCTID) { 
		rnCTID = 4;
		if (!rnSCID) { rnSCID = 0; }
	}
	if (!rnSCID) { rnSCID = rnCTID; }
	document.location = 'http://' + rsCustomer + '.links.channelintelligence.com/pages/redirector.asp?' + (rnSCID ? 'nSCID=' + rnSCID + '&' : '') + 'nCTID=' + rnCTID + '&sSKU=' + escape(rsSKU).replace('+','%2B') + '&nVID=' + rnVendorID + (rsClientTag ? '&sCT=' + escape(rsClientTag).replace('+','%2B') : '') + (rbICI ? '&nICI=1' : '');
}
function manu_PurchaseInWindow(rsCustomer,rsSKU,rnVendorID,rsClientTag,nHeight,nWidth,rbFullChrome,rbICI,rnCTID,rnSCID) {
	if (!rnCTID) {
		rnCTID = 4;
		if (!rnSCID) { rnSCID = 0; }
	}
	if (!rnSCID) { rnSCID = rnCTID; }
	oWin = ykb_PopUp('cii_com', rsCustomer, 'http://' + rsCustomer + '.links.channelintelligence.com/pages/redirector.asp?' + (rnSCID ? 'nSCID=' + rnSCID + '&' : '') + 'nCTID=' + rnCTID + '&sSKU=' + escape(rsSKU).replace('+','%2B') + '&nVID=' + rnVendorID + (rsClientTag ? '&sCT=' + escape(rsClientTag).replace('+','%2B') : '') + (rbICI ? '&nICI=1' : ''), (nHeight && nHeight != '' ? nHeight : '430'), (nWidth && nWidth != '' ? nWidth : '800'), 'middle', 'center', true, (rbFullChrome ? 'browser' : ''), true, true, true, true);
	oWin.focus();
}
function manu_InlineCDLink(rsCustomer,rsSKU,rsClientTag,rnSCID) {
	document.location.replace('http://' + rsCustomer + '.links.channelintelligence.com/pages/prices.asp?' + (rnSCID ? 'nSCID=' + rnSCID + '&' : '') + 'sSKU=' + escape(rsSKU).replace('+','%2B') + (rsClientTag ? '&sCT=' + escape(rsClientTag).replace('+','%2B') : ''));
}
function manu_InlineCDRuleGroupLink(rsCustomer,rsSKU,rnRGID,rsClientTag,rnSCID) {
	document.location.replace('http://' + rsCustomer + '.links.channelintelligence.com/pages/prices.asp?' + (rnSCID ? 'nSCID=' + rnSCID + '&' : '') + 'sSKU=' + escape(rsSKU).replace('+','%2B') + '&nRGID=' + rnRGID + (rsClientTag ? '&sCT=' + escape(rsClientTag).replace('+','%2B') : ''));
}
function manu_DirectCDLink(rsCustomer,rsSKU,rsClientTag,rnSCID,rsAName) {
	document.location = 'http://' + rsCustomer + '.links.channelintelligence.com/pages/prices.asp?' + (rnSCID ? 'nSCID=' + rnSCID + '&' : '') + 'sSKU=' + escape(rsSKU).replace('+','%2B') + (rsClientTag ? '&sCT=' + escape(rsClientTag).replace('+','%2B') : '') + (rsAName ? '&sAName=' + escape(rsAName).replace('+','%2B') : '');
}
function manu_DirectCDRuleGroupLink(rsCustomer,rsSKU,rnRGID,rsClientTag,rnSCID,rsAName) {
	document.location = 'http://' + rsCustomer + '.links.channelintelligence.com/pages/prices.asp?' + (rnSCID ? 'nSCID=' + rnSCID + '&' : '') + 'sSKU=' + escape(rsSKU).replace('+','%2B') + '&nRGID=' + rnRGID + (rsClientTag ? '&sCT=' + escape(rsClientTag).replace('+','%2B') : '') + (rsAName ? '&sAName=' + escape(rsAName).replace('+','%2B') : '');
}
function manu_CDRuleLink(rsCustomer,rsSKU,rnRID,nHeight,nWidth,rbFullChrome,rsClientTag,rnSCID,rsAName) {
	oWin = ykb_PopUp('cii_com_' + Math.round(Math.random() * 1000), rsCustomer, 'http://' + rsCustomer + '.links.channelintelligence.com/pages/prices.asp?' + (rnSCID ? 'nSCID=' + rnSCID + '&' : '') + 'sSKU=' + escape(rsSKU).replace('+','%2B') + '&nRID=' + rnRID + (rsClientTag ? '&sCT=' + escape(rsClientTag).replace('+','%2B') : '') + (rsAName ? '&sAName=' + escape(rsAName).replace('+','%2B') : ''), (nHeight && nHeight != '' ? nHeight : '430'), (nWidth && nWidth != '' ? nWidth : '800'), 'middle', 'center', true, (rbFullChrome ? 'browser' : ''), true, true, true);
	oWin.focus();
}
function manu_CDRuleGroupLink(rsCustomer,rsSKU,rnRGID,nHeight,nWidth,rbFullChrome,rsClientTag,rnSCID,rsAName) {
	oWin = ykb_PopUp('cii_com_' + Math.round(Math.random() * 1000), rsCustomer, 'http://' + rsCustomer + '.links.channelintelligence.com/pages/prices.asp?' + (rnSCID ? 'nSCID=' + rnSCID + '&' : '') + 'sSKU=' + escape(rsSKU).replace('+','%2B') + '&nRGID=' + rnRGID + (rsClientTag ? '&sCT=' + escape(rsClientTag).replace('+','%2B') : '') + (rsAName ? '&sAName=' + escape(rsAName).replace('+','%2B') : ''), (nHeight && nHeight != '' ? nHeight : '430'), (nWidth && nWidth != '' ? nWidth : '800'), 'middle', 'center', true, (rbFullChrome ? 'browser' : ''), true, true, true);
	oWin.focus();
}
function ykb_PopUp(sName,sTitle,sURL,nHeight,nWidth,sValign,sAlign,bResizeable,sType,bScrollBars,bToolbar,bStatusBar,bMenuBar,bLocation) {
	if (!nHeight) { nHeight = 10; }
	if (!nWidth) { nWidth = 10; }
	if (nHeight != '-1') {
		var sString = cii_lc(nHeight);
		if (sString.substr(sString.length - 1, 1) == '%') {
			nHeight = screen.height * sString.substr(0, sString.length - 1) / 100;
		} else if (nHeight == 0) {
			nHeight = 100;
		} else {
			nHeight = nHeight / 1;
		}
	}
	if (nWidth != '-1') {
		var sString = cii_lc(nWidth);
		if (sString.substr(sString.length - 1, 1) == '%') {
			nWidth = screen.width * sString.substr(0, sString.length - 1) / 100;
		} else if (nWidth == 0) {
			nWidth = 100;
		} else {
			nWidth = nWidth / 1;
		}
	}
	var sConfig = '';
	if (!bResizeable) { 
		sConfig += ',resizable=no';
	} else {
		sConfig += ',resizable=yes';
	}
	if (sType && cii_lc(sType) == 'browser') {
		sConfig += ',directories=no,location=yes,menubar=yes,status=yes,titlebar=yes,toolbar=yes,scrollbars=yes';
	} else {
		sConfig += ',directories=no,titlebar=no';
		if (!bStatusBar) {
			sConfig += ',status=no';
		} else {
			sConfig += ',status=yes';
			nHeight += 20;
		}
		if (!bToolbar) {
			sConfig += ',toolbar=no'
		} else {
			sConfig += ',toolbar=yes';
			nHeight += 80;
		}
		if (!bScrollBars) {
			sConfig += ',scrollbars=no'
		} else {
			sConfig += ',scrollbars=yes';
		}
		if (!bLocation) {
			sConfig += ',location=no'
		} else {
			sConfig += ',location=yes';
		}
		if (!bMenuBar) {
			sConfig += ',menubar=no'
		} else {
			sConfig += ',menubar=yes';
		}
	}
	if (nHeight > screen.height - 5) {	nHeight = screen.height - 20; }
	if (nWidth > screen.width - 5) { nWidth = screen.width - 20; }
	var nY = 0;
	if (sValign) {
		sValign = cii_lc(sValign);
		if (sValign == 'middle') {
			nY = (screen.height - (!bToolbar ? 0 : 80) - nHeight)/2;
		} else if (sValign == 'top') {
			nY = 0;
		} else if (sValign == 'bottom') {
			nY = screen.height - nHeight;
		} else if (event && sValign == 'here') {
			nY = event.screenY;
		} else if (sValign == 'hidden') {
			nY = screen.height + 1;
		} else {
			nY = (screen.height-nHeight)/2
		}
		if (nY > 0 && (nY + nHeight > screen.height)) { nY = screen.height - nHeight - 40; }
		if (nY < 0) { nY = 0; }
		sConfig += ',screenY='+nY+',top='+nY;
	}
	var nX = 0;
	if (sAlign) {
		sAlign = cii_lc(sAlign);
		if (sAlign == 'center') {
			nX = (screen.width-nWidth)/2 - 5;
		} else if (sAlign == 'left') {
			nX = 0;
		} else if (sAlign == 'right') {
			nX = screen.width - nWidth - 13;
		} else if (event && sAlign == 'here') {
			nX = event.screenX + 10;
		} else if (sAlign == 'hidden') {
			nX = screen.width + 1;
		} else {
			nX = (screen.width-nWidth)/2;
		} 
		if (nX > 0 && (nX + nWidth > screen.width)) { nX = screen.width - nWidth - 40; }
		if (nX < 0) { nX = 0; }
		sConfig += ',screenX='+nX+',left='+nX;
	}
	if (nHeight != -1) { sConfig = 'height=' + nHeight + ',' + sConfig; }
	if (nWidth != -1) {	sConfig = 'width=' + nWidth + ',' + sConfig; }
	if (sName) {
		sName = cii_StringReplace(sName,' ','_');
		sName = cii_StringReplace(sName,'(','_');
		sName = cii_StringReplace(sName,')','_');
		sName = cii_StringReplace(sName,'-','_');
	}
//	if (window.top.gsUniqueID) {
//		var loWin = window.open(sURL,sName + window.top.gsUniqueID,config=''+sConfig,false);
//	} else {
		var loWin = window.open(sURL,sName,config=''+sConfig,false);
//	}
	if (loWin != null) {
		loWin.focus();
	}
	return loWin;
}
function ykb_WindowMoveTo(roWin, rnHeight, rnWidth, rsValign, rsAlign) {
	var nY = 0;
	if (!rnHeight) { rnHeight = roWin.document.body.offsetHeight + 20; }
	if (!rnWidth) { rnWidth = roWin.document.body.offsetWidth; }
	if (rsValign) {
		rsValign = cii_lc(rsValign);
		if (rsValign == 'middle') {
			nY = (screen.height-rnHeight)/2
		} else if (rsValign == 'top') {
			nY = 0;
		} else if (rsValign == 'bottom') {
			nY = screen.height - rnHeight;
		} else if (event && rsValign == 'here') {
			nY = event.screenY;
		} else if (sValign == 'hidden') {
			nY = screen.height + 1;
		} else {
			nY = (screen.height-rnHeight)/2
		}
	}
	var nX = 0;
	if (rsAlign) {
		rsAlign = cii_lc(rsAlign);
		if (rsAlign == 'center') {
			nX = (screen.width-rnWidth)/2;
		} else if (rsAlign == 'left') {
			nX = 0;
		} else if (rsAlign == 'right') {
			nX = screen.width - nWidth - 10;
		} else if (event && rsAlign == 'here') {
			nX = event.screenX + 10;
		} else if (sAlign == 'hidden') {
			nX = screen.width + 1;
		} else {
			nX = (screen.width-rnWidth)/2;
		} 
	}
	if (nY > 0 && (nY + rnHeight > screen.height)) { nY = screen.height - rnHeight - 40; }
	if (nX > 0 && (nX + rnWidth > screen.width)) { nX = screen.width - rnWidth - 40; }
	if (nY < 0) { nY = 0; }
	if (nX < 0) { nX = 0; }
	roWin.moveTo(nX, nY);
}
function cii_WindowResize(roWin, rnHeight, rnWidth) {
	var sString = cii_lc(rnHeight);
	var sString = cii_lc(rnWidth);
	if (sString.substr(sString.length - 1, 1) == '%') { rnHeight = screen.height * sString.substr(0, sString.length - 1) / 100; }
	if (sString.substr(sString.length - 1, 1) == '%') { rnWidth = screen.width * sString.substr(0, sString.length - 1) / 100; }
	oDim = new Object();
	oDim.nWidth = rnWidth;
	oDim.nHeight = rnHeight;
	roWin.resizeTo(oDim.nWidth, oDim.nHeight);	
	return oDim;
}
function cii_lc(rsString) {
	sString = new String(rsString);
	return sString.toLowerCase();
}
function cii_StringReplace(rsStr,rsOldStr,rsNewStr) {
	var nLen = rsStr.length;
	var nOldLen = rsOldStr.length;
	var nPos = rsStr.indexOf(rsOldStr);
	if ((nLen == 0) || (nOldLen == 0)) return rsStr;
	if ((!nPos) && (rsOldString != string.substring(0, nOldLen))) return rsStr;
	if (nPos == -1) return rsStr;
	var sStr = rsStr.substring(0, nPos) + rsNewStr;
	if (nPos + nOldLen < nLen) { sStr += cii_StringReplace(rsStr.substring(nPos + nOldLen,nLen), rsOldStr, rsNewStr); }
	return sStr;
}
function cii_AddArg(rsURL, rsField, rsValue) { 
	return rsURL += (rsURL == '' ? '' : "&") + rsField + '=' + escape(rsValue);
}
function cii_Unique(rdDate) {
	var sBase = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
	var nRand = Math.floor((rdDate.getTime() - 946875600000) / 604800000);
	return sBase.charAt((rdDate.getYear() < 2000 ? rdDate.getFullYear() : rdDate.getYear()) - 2000) + sBase.charAt(rdDate.getMonth() + 1) + sBase.charAt(rdDate.getDate()) + sBase.charAt(rdDate.getHours()) + sBase.charAt(rdDate.getMinutes()) + sBase.charAt(rdDate.getSeconds()) + sBase.charAt((nRand - (nRand % 16)) / 16) + sBase.charAt(nRand % 16);
}	
function cii_PageData() {
	var sURL = '';
	var dDate = new Date();
	var aDomainData = document.URL.split('/')[2].split('.');
	var sSite = aDomainData[0];
	if (typeof(sSite) == 'undefined') {
		sSite = '';
	} else if (aDomainData.length == 4 && !isNaN(parseInt(aDomainData[3]))) {
		sSite = aDomainData.join('.');
	} else if (aDomainData.length > 1) {
		sSite = aDomainData[aDomainData.length - 2];
	}
	sURL = cii_AddArg(sURL, 's', sSite);
	sURL = cii_AddArg(sURL, 'u', cii_Unique(dDate));
	sURL = cii_AddArg(sURL, 'js', 'true');
	sURL = cii_AddArg(sURL, 'tz', dDate.getTimezoneOffset());
	sURL = cii_AddArg(sURL, 'la', (typeof(navigator.language) == 'string' ? navigator.language : (typeof(navigator.userLanguage) == 'string' ? navigator.userLanguage : '')));
	if(typeof(screen) == 'object') {
		sURL = cii_AddArg(sURL, 'sr', screen.width + 'x' + screen.height);
		sURL = cii_AddArg(sURL, 'cd', screen.colorDepth);
		sURL = cii_AddArg(sURL, 'jv', navigator.javaEnabled() ? 'true' : 'false');
	}
	sURL = cii_AddArg(sURL, 'pt', (typeof(document.title) == 'string' ? document.title : ''));
	sURL = cii_AddArg(sURL, 'ur', (typeof(document.URL) == 'string' ? document.URL : ''));
	sURL = cii_AddArg(sURL, 'rf', (typeof(window.document.referrer) == 'string' ? window.document.referrer : ''));
	sURL = 'http' + (document.URL.indexOf('https:') == 0 ? 's://secure.channelintelligence.com/links/pages/pgld.asp?' : '://content.channelintelligence.com/pages/pgld.asp?') + '' + sURL
	if (navigator.userAgent.indexOf('MSIE') >= 0 && sURL.length > 2048) { sURL = sURL.substring(0, 2044) + '&z=1'; }
	var oImage = new Image();
	oImage.src = sURL;
}
//cii_PageData();
function ykb_Purchase(rsCustomer,rnIID,rnVendorID,rsClientTag,rbICI) {
	document.location = 'http://' + rsCustomer + '.links.channelintelligence.com/pages/redirector.asp?nCTID=4&nIID=' + rnIID + '&nVID=' + rnVendorID + (rsClientTag ? '&sCT=' + escape(rsClientTag).replace('+','%2B') : '') + (rbICI ? '&nICI=1' : '');
}
function ykb_InlineCDLink(rsCustomer,rnIID,rsClientTag) {
	document.location.replace('http://' + rsCustomer + '.links.channelintelligence.com/pages/prices.asp?nIID=' + rnIID + (rsClientTag ? '&sCT=' + escape(rsClientTag).replace('+','%2B') : ''));
}
function ykb_InlineCDRuleGroupLink(rsCustomer,rnIID,rnRGID,rsClientTag) {
	document.location.replace('http://' + rsCustomer + '.links.channelintelligence.com/pages/prices.asp?nIID=' + rnIID + '&nRGID=' + rnRGID + (rsClientTag ? '&sCT=' + escape(rsClientTag).replace('+','%2B') : ''));
}
function ykb_DirectCDLink(rsCustomer,rnIID,rsClientTag) {
	document.location = 'http://' + rsCustomer + '.links.channelintelligence.com/pages/prices.asp?nIID=' + rnIID + (rsClientTag ? '&sCT=' + escape(rsClientTag).replace('+','%2B') : '');
}
function ykb_DirectCDRuleGroupLink(rsCustomer,rnIID,rnRGID,rsClientTag) {
	document.location = 'http://' + rsCustomer + '.links.channelintelligence.com/pages/prices.asp?nIID=' + rnIID + '&nRGID=' + rnRGID + (rsClientTag ? '&sCT=' + escape(rsClientTag).replace('+','%2B') : '');
}
function ykb_CDLink(rsCustomer,rnIID,nHeight,nWidth,rbFullChrome,rsClientTag) {
	oWin = ykb_PopUp('cii_com_' + Math.round(Math.random() * 1000), rsCustomer, 'http://' + rsCustomer + '.links.channelintelligence.com/pages/prices.asp?nIID=' + rnIID + (rsClientTag ? '&sCT=' + escape(rsClientTag).replace('+','%2B') : ''), (nHeight && nHeight != '' ? nHeight : '430'), (nWidth && nWidth != '' ? nWidth : '800'), 'middle', 'center', true, (rbFullChrome ? 'browser' : ''), true, true, true);
	oWin.focus();
}
function ykb_CDRuleLink(rsCustomer,rnIID,rnRID,nHeight,nWidth,rbFullChrome,rsClientTag) {
	oWin = ykb_PopUp('cii_com_' + Math.round(Math.random() * 1000), rsCustomer, 'http://' + rsCustomer + '.links.channelintelligence.com/pages/prices.asp?nIID=' + rnIID + '&nRID=' + rnRID + (rsClientTag ? '&sCT=' + escape(rsClientTag).replace('+','%2B') : ''), (nHeight ? nHeight && nHeight != '' : '430'), (nWidth && nWidth != '' ? nWidth : '800'), 'middle', 'center', true, (rbFullChrome ? 'browser' : ''), true, true, true);
	oWin.focus();
}
function ykb_CDRuleGroupLink(rsCustomer,rnIID,rnRGID,nHeight,nWidth,rbFullChrome,rsClientTag) {
	oWin = ykb_PopUp('cii_com_' + Math.round(Math.random() * 1000), rsCustomer, 'http://' + rsCustomer + '.links.channelintelligence.com/pages/prices.asp?nIID=' + rnIID + '&nRGID=' + rnRGID + (rsClientTag ? '&sCT=' + escape(rsClientTag).replace('+','%2B') : ''), (nHeight && nHeight != '' ? nHeight : '430'), (nWidth && nWidth != '' ? nWidth : '800'), 'middle', 'center', true, (rbFullChrome ? 'browser' : ''), true, true, true);
	oWin.focus();
}
function ykb_PopItem(rsURL) {
	oWin = ykb_PopUp('cii_com_' + Math.round(Math.random() * 1000), rsCustomer, rsURL, (nHeight ? nHeight : '430'), (nWidth ? nWidth : '800'), 'middle', 'center', true, '', true, true, true);
}
function ykb_PopupURL(rsURL,bFreshWindow) {
	bFreshWindow = true;
	if (bFreshWindow) {
		oWin = ykb_PopUp('Site' + Math.round(Math.random() * 1000), 'Site', rsURL, '50%', '50%', 'middle', 'center', true, 'Broswser', true, true);
	} else {
		oWin = ykb_PopUp('Site', 'Site', rsURL, '50%', '50%', 'middle', 'center', true, 'Broswser', true);
	}
	oWin.focus();
}
