// JScript File

function MiscImages(Image_Normal, Image) {
	this.Image_Normal = Image_Normal;
	this.Image = Image;
}



function ShowImage(Image_Normal, ImageNo, TotalImages, Image) {
	document.productform.elements["ImageNo"].value = ImageNo;
	document.getElementById('CurrentImage').innerHTML = ImageNo+"/" + TotalImages; 
    document.getElementById("LookInside").src = Image_Normal;
	document.productform.elements["zoom-image"].value = Image; 
}


function ShowPrevImage(TotalImages) {
	var ImageNo = document.productform.elements["ImageNo"].value;
	if(ImageNo>1) {
		var PrevImage1 = (ImageNo*1 -1);
		var PrevImage = (ImageNo*1 -2);
		ImageToShow = Images[PrevImage].Image;
		document.getElementById('CurrentImage').innerHTML = PrevImage1+"/" + TotalImages; 
		document.getElementById("LookInside").src = ImageToShow;
		document.productform.elements["ImageNo"].value = PrevImage1;
		document.productform.elements["zoom-image"].value = Images[PrevImage].Image; 
	}
}


function ShowNextImage(TotalImages) {
	var ImageNo = document.productform.elements["ImageNo"].value;
	if(ImageNo<TotalImages) {
		var NextImage1 = (ImageNo*1 +1);
		var NextImage = (ImageNo*1);	
		ImageToShow = Images[NextImage].Image;
		document.getElementById('CurrentImage').innerHTML = NextImage1+"/" + TotalImages; 
		document.getElementById("LookInside").src = ImageToShow;
		document.productform.elements["ImageNo"].value = NextImage1;
		document.productform.elements["zoom-image"].value = Images[NextImage].Image; 
	}
}

 function showDiv(i_divs) {
                        		
	divname = document.getElementById('showdiv'+i_divs);

	if (divname.style.display=='none') {
		divname.style.display='';
		divname.style.visibility='visible';
	}
	else {
		divname.style.display='none';
		divname.style.visibility='hidden';		
	}
}

function launchGenericPopUp(winName, url, w, h, incScroll)
{	
	var newWindow = window.open(url, winName, 'width='+w+',height='+h+',menubar=no,resizable=1,status=no,scrollbars='+incScroll);
	if (window.focus) {
		newWindow.focus();
	}	
}


function findPosX2(obj)
{
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY2(obj)
{
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}


function show(id, x, y, rc)
{
	var defId = "defImage_"+rc;
	
	x1 = findPosX2(document.getElementById(defId));
	y1 = findPosY2(document.getElementById(defId));
	document.getElementById(id).setAttribute('position', 'absolute');
	
	document.getElementById(id).style.left = (x1 + x) + "px";
	document.getElementById(id).style.top = (y1 + y) + "px";
	
	document.getElementById(id).style.visibility = "visible";
	alert(id);

}

function hide(id)
{	
	document.getElementById(id).style.visibility = "hidden";
}












/*  Prototype JavaScript framework

 *  (c) 2005 Sam Stephenson <sam@conio.net>

 *  Prototype is freely distributable under the terms of an MIT-style license.

 *  For details, see the Prototype web site: http://prototype.conio.net/

/*--------------------------------------------------------------------------*/



//note: modified & stripped down version of prototype, to be used with moo.fx by mad4milk (http://moofx.mad4milk.net).



var Class = {

	create: function() {

		return function() {

			this.initialize.apply(this, arguments);

		}

	}

}



Object.extend = function(destination, source) {

	for (property in source) destination[property] = source[property];

	return destination;

}



Function.prototype.bind = function(object) {

	var __method = this;

	return function() {

		return __method.apply(object, arguments);

	}

}



Function.prototype.bindAsEventListener = function(object) {

var __method = this;

	return function(event) {

		__method.call(object, event || window.event);

	}

}



function $() {

	if (arguments.length == 1) return get$(arguments[0]);

	var elements = [];

	$c(arguments).each(function(el){

		elements.push(get$(el));

	});

	return elements;



	function get$(el){

		if (typeof el == 'string') el = document.getElementById(el);

		return el;

	}

}



if (!window.Element) var Element = new Object();



Object.extend(Element, {

	remove: function(element) {

		element = $(element);

		element.parentNode.removeChild(element);

	},



	hasClassName: function(element, className) {

		element = $(element);

		if (!element) return;

		var hasClass = false;

		element.className.split(' ').each(function(cn){

			if (cn == className) hasClass = true;

		});

		return hasClass;

	},



	addClassName: function(element, className) {

		element = $(element);

		Element.removeClassName(element, className);

		element.className += ' ' + className;

	},

  

	removeClassName: function(element, className) {

		element = $(element);

		if (!element) return;

		var newClassName = '';

		element.className.split(' ').each(function(cn, i){

			if (cn != className){

				if (i > 0) newClassName += ' ';

				newClassName += cn;

			}

		});

		element.className = newClassName;

	},



	cleanWhitespace: function(element) {

		element = $(element);

		$c(element.childNodes).each(function(node){

			if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) Element.remove(node);

		});

	},



	find: function(element, what) {

		element = $(element)[what];

		while (element.nodeType != 1) element = element[what];

		return element;

	}

});



var Position = {

	cumulativeOffset: function(element) {

		var valueT = 0, valueL = 0;

		do {

			valueT += element.offsetTop  || 0;

			valueL += element.offsetLeft || 0;

			element = element.offsetParent;

		} while (element);

		return [valueL, valueT];

	}

};



document.getElementsByClassName = function(className) {

	var children = document.getElementsByTagName('*') || document.all;

	var elements = [];

	$c(children).each(function(child){

		if (Element.hasClassName(child, className)) elements.push(child);

	});  

	return elements;

}



//useful array functions

Array.prototype.iterate = function(func){

	for(var i=0;i<this.length;i++) func(this[i], i);

}

if (!Array.prototype.each) Array.prototype.each = Array.prototype.iterate;



function $c(array){

	var nArray = [];

	for (var i=0;i<array.length;i++) nArray.push(array[i]);

	return nArray;

}



















/*

moo.fx, simple effects library built with prototype.js (http://prototype.conio.net).

by Valerio Proietti (http://mad4milk.net) MIT-style LICENSE.

for more info (http://moofx.mad4milk.net).

Sunday, March 05, 2006

v 1.2.3

*/



var fx = new Object();

//base

fx.Base = function(){};

fx.Base.prototype = {

	setOptions: function(options) {

	this.options = {

		duration: 500,

		onComplete: '',

		transition: fx.sinoidal

	}

	Object.extend(this.options, options || {});

	},



	step: function() {

		var time  = (new Date).getTime();

		if (time >= this.options.duration+this.startTime) {

			this.now = this.to;

			clearInterval (this.timer);

			this.timer = null;

			if (this.options.onComplete) setTimeout(this.options.onComplete.bind(this), 10);

		}

		else {

			var Tpos = (time - this.startTime) / (this.options.duration);

			this.now = this.options.transition(Tpos) * (this.to-this.from) + this.from;

		}

		this.increase();

	},



	custom: function(from, to) {

		if (this.timer != null) return;

		this.from = from;

		this.to = to;

		this.startTime = (new Date).getTime();

		this.timer = setInterval (this.step.bind(this), 13);

	},



	hide: function() {

		this.now = 0;

		this.increase();

	},



	clearTimer: function() {

		clearInterval(this.timer);

		this.timer = null;

	}

}



//stretchers

fx.Layout = Class.create();

fx.Layout.prototype = Object.extend(new fx.Base(), {

	initialize: function(el, options) {

		this.el = $(el);

		this.el.style.overflow = "hidden";

		this.iniWidth = this.el.offsetWidth;

		this.iniHeight = this.el.offsetHeight;

		this.setOptions(options);

	}

});



fx.Height = Class.create();

Object.extend(Object.extend(fx.Height.prototype, fx.Layout.prototype), {	

	increase: function() {

		this.el.style.height = this.now + "px";

	},



	toggle: function() {

		if (this.el.offsetHeight > 0) this.custom(this.el.offsetHeight, 0);

		else this.custom(0, this.el.scrollHeight);

	}

});



fx.Width = Class.create();

Object.extend(Object.extend(fx.Width.prototype, fx.Layout.prototype), {	

	increase: function() {

		this.el.style.width = this.now + "px";

	},



	toggle: function(){

		if (this.el.offsetWidth > 0) this.custom(this.el.offsetWidth, 0);

		else this.custom(0, this.iniWidth);

	}

});



//fader

fx.Opacity = Class.create();

fx.Opacity.prototype = Object.extend(new fx.Base(), {

	initialize: function(el, options) {

		this.el = $(el);

		this.now = 1;

		this.increase();

		this.setOptions(options);

	},



	increase: function() {

		if (this.now == 1 && (/Firefox/.test(navigator.userAgent))) this.now = 0.9999;

		this.setOpacity(this.now);

	},

	

	setOpacity: function(opacity) {

		if (opacity == 0 && this.el.style.visibility != "hidden") this.el.style.visibility = "hidden";

		else if (this.el.style.visibility != "visible") this.el.style.visibility = "visible";

		if (window.ActiveXObject) this.el.style.filter = "alpha(opacity=" + opacity*100 + ")";

		this.el.style.opacity = opacity;

	},



	toggle: function() {

		if (this.now > 0) this.custom(1, 0);

		else this.custom(0, 1);

	}

});



//transitions

fx.sinoidal = function(pos){

	return ((-Math.cos(pos*Math.PI)/2) + 0.5);

	//this transition is from script.aculo.us

}

fx.linear = function(pos){

	return pos;

}

fx.cubic = function(pos){

	return Math.pow(pos, 3);

}

fx.circ = function(pos){

	return Math.sqrt(pos);

}





















/*

moo.fx pack, effects extensions for moo.fx.

by Valerio Proietti (http://mad4milk.net) MIT-style LICENSE

for more info visit (http://moofx.mad4milk.net).

Friday, April 14, 2006

v 1.2.4

*/



//smooth scroll

fx.Scroll = Class.create();

fx.Scroll.prototype = Object.extend(new fx.Base(), {

	initialize: function(options) {

		this.setOptions(options);

	},



	scrollTo: function(el){

		var dest = Position.cumulativeOffset($(el))[1];

		var client = window.innerHeight || document.documentElement.clientHeight;

		var full = document.documentElement.scrollHeight;

		var top = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;

		if (dest+client > full) this.custom(top, dest - client + (full-dest));

		else this.custom(top, dest);

	},



	increase: function(){

		window.scrollTo(0, this.now);

	}

});



//text size modify, now works with pixels too.

fx.Text = Class.create();

fx.Text.prototype = Object.extend(new fx.Base(), {

	initialize: function(el, options) {

		this.el = $(el);

		this.setOptions(options);

		if (!this.options.unit) this.options.unit = "em";

	},



	increase: function() {

		this.el.style.fontSize = this.now + this.options.unit;

	}

});



//composition effect: widht/height/opacity

fx.Combo = Class.create();

fx.Combo.prototype = {

	setOptions: function(options) {

		this.options = {

			opacity: true,

			height: true,

			width: false

		}

		Object.extend(this.options, options || {});

	},



	initialize: function(el, options) {

		this.el = $(el);

		this.setOptions(options);

		if (this.options.opacity) {

			this.o = new fx.Opacity(el, options);

			options.onComplete = null;

		}

		if (this.options.height) {

			this.h = new fx.Height(el, options);

			options.onComplete = null;

		}

		if (this.options.width) this.w = new fx.Width(el, options);

	},

	

	toggle: function() { this.checkExec('toggle'); },



	hide: function(){ this.checkExec('hide'); },

	

	clearTimer: function(){ this.checkExec('clearTimer'); },

	

	checkExec: function(func){

		if (this.o) this.o[func]();

		if (this.h) this.h[func]();

		if (this.w) this.w[func]();

	},

	

	//only if width+height

	resizeTo: function(hto, wto) {

		if (this.h && this.w) {

			this.h.custom(this.el.offsetHeight, this.el.offsetHeight + hto);

			this.w.custom(this.el.offsetWidth, this.el.offsetWidth + wto);

		}

	},



	customSize: function(hto, wto) {

		if (this.h && this.w) {

			this.h.custom(this.el.offsetHeight, hto);

			this.w.custom(this.el.offsetWidth, wto);

		}

	}

}



fx.Accordion = Class.create();

fx.Accordion.prototype = {

	setOptions: function(options) {

		this.options = {

			delay: 100,

			opacity: false

		}

		Object.extend(this.options, options || {});

	},



	initialize: function(togglers, elements, options) {

		this.elements = elements;

		this.setOptions(options);

		var options = options || '';

		this.fxa = [];

		if (options && options.onComplete) options.onFinish = options.onComplete;

		elements.each(function(el, i){

			options.onComplete = function(){

				if (el.offsetHeight > 0) el.style.height = '1%';

				if (options.onFinish) options.onFinish(el);

			}

			this.fxa[i] = new fx.Combo(el, options);

			this.fxa[i].hide();

		}.bind(this));



		togglers.each(function(tog, i){

			if (typeof tog.onclick == 'function') var exClick = tog.onclick;

			tog.onclick = function(){

				if (exClick) exClick();

				this.showThisHideOpen(elements[i]);

			}.bind(this);

		}.bind(this));

	},



	showThisHideOpen: function(toShow){

		this.elements.each(function(el, j){

			if (el.offsetHeight > 0 && el != toShow) this.clearAndToggle(el, j);

			if (el == toShow && toShow.offsetHeight == 0) setTimeout(function(){this.clearAndToggle(toShow, j);}.bind(this), this.options.delay);

		}.bind(this));

	},



	clearAndToggle: function(el, i){

		this.fxa[i].clearTimer();

		this.fxa[i].toggle();

	}

}



var Remember = new Object();

Remember = function(){};

Remember.prototype = {

	initialize: function(el, options){

		this.el = $(el);

		this.days = 365;

		this.options = options;

		this.effect();

		var cookie = this.readCookie();

		if (cookie) {

			this.fx.now = cookie;

			this.fx.increase();

		}

	},



	//cookie functions based on code by Peter-Paul Koch

	setCookie: function(value) {

		var date = new Date();

		date.setTime(date.getTime()+(this.days*24*60*60*1000));

		var expires = "; expires="+date.toGMTString();

		document.cookie = this.el+this.el.id+this.prefix+"="+value+expires+"; path=/";

	},



	readCookie: function() {

		var nameEQ = this.el+this.el.id+this.prefix + "=";

		var ca = document.cookie.split(';');

		for(var i=0;c=ca[i];i++) {

			while (c.charAt(0)==' ') c = c.substring(1,c.length);

			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);

		}

		return false;

	},



	custom: function(from, to){

		if (this.fx.now != to) {

			this.setCookie(to);

			this.fx.custom(from, to);

		}

	}

}



fx.RememberHeight = Class.create();

fx.RememberHeight.prototype = Object.extend(new Remember(), {

	effect: function(){

		this.fx = new fx.Height(this.el, this.options);

		this.prefix = 'height';

	},

	

	toggle: function(){

		if (this.el.offsetHeight == 0) this.setCookie(this.el.scrollHeight);

		else this.setCookie(0);

		this.fx.toggle();

	},

	

	resize: function(to){

		this.setCookie(this.el.offsetHeight+to);

		this.fx.custom(this.el.offsetHeight,this.el.offsetHeight+to);

	},



	hide: function(){

		if (!this.readCookie()) {

			this.fx.hide();

		}

	}

});



fx.RememberText = Class.create();

fx.RememberText.prototype = Object.extend(new Remember(), {

	effect: function(){

		this.fx = new fx.Text(this.el, this.options);

		this.prefix = 'text';

	}

});



//useful for-replacement

Array.prototype.iterate = function(func){

	for(var i=0;i<this.length;i++) func(this[i], i);

}

if (!Array.prototype.each) Array.prototype.each = Array.prototype.iterate;



//Easing Equations (c) 2003 Robert Penner, all rights reserved.

//This work is subject to the terms in http://www.robertpenner.com/easing_terms_of_use.html.



//expo

fx.expoIn = function(pos){

	return Math.pow(2, 10 * (pos - 1));

}

fx.expoOut = function(pos){

	return (-Math.pow(2, -10 * pos) + 1);

}



//quad

fx.quadIn = function(pos){

	return Math.pow(pos, 2);

}

fx.quadOut = function(pos){

	return -(pos)*(pos-2);

}



//circ

fx.circOut = function(pos){

	return Math.sqrt(1 - Math.pow(pos-1,2));

}

fx.circIn = function(pos){

	return -(Math.sqrt(1 - Math.pow(pos, 2)) - 1);

}



//back

fx.backIn = function(pos){

	return (pos)*pos*((2.7)*pos - 1.7);

}

fx.backOut = function(pos){

	return ((pos-1)*(pos-1)*((2.7)*(pos-1) + 1.7) + 1);

}



//sine

fx.sineOut = function(pos){

	return Math.sin(pos * (Math.PI/2));

}

fx.sineIn = function(pos){

	return -Math.cos(pos * (Math.PI/2)) + 1;

}

fx.sineInOut = function(pos){

	return -(Math.cos(Math.PI*pos) - 1)/2;

}










function fadeIt(direction) {
	var imageObj = new fx.Opacity('image'+count, {duration:1000});

	imageObj.setOpacity(1);
	imageObj.custom(1,0);	

	if(direction=='forwards') {
		if(count < total) {
			count=count+1;
		} else {
		count=1;
		}
	} else {
		if(count > 1) {
			count=count-1;
		} else {
			count=total;
		}
	}


	if(document.getElementById('image'+count).style.display!='block') {
		document.getElementById('image'+count).style.display='block';
	}


	var imageObj = new fx.Opacity('image'+count, {duration:1000});

	imageObj.setOpacity(0);
	imageObj.custom(0,1);

	showCount();
	scrollTimer();
}
	
function hideThem() {

	document.getElementById('image1').style.display='block';
	var imageObj1 = new fx.Opacity('image1', {duration:1000});

	imageObj1.setOpacity(0);
	imageObj1.custom(0,1);

	for(var loopCount = 2; loopCount <= total; loopCount++) {
		var imageObj = new fx.Opacity('image'+loopCount);
		imageObj.setOpacity(0);
	}
}
	
function showCount() {
	document.getElementById('counterBox').innerHTML=count+'/'+total;
}
	
scrollTime = 10000;
	
function scrollTimer() {
	window.clearTimeout(tOut);
	tOut = setTimeout("fadeIt('forwards');",scrollTime); 
}



function SetVisible(divid, visibility) {
	document.getElementById(divid).style.visibility = visibility;

}
function findPosX(obj) {
    var curleft = 0;
    if (obj.offsetParent) {
        while (1) {
            curleft+=obj.offsetLeft;
            if (!obj.offsetParent) {
                break;
            }
            obj=obj.offsetParent;
        }
    } else if (obj.x) {
        curleft+=obj.x;
    }
    return curleft;
}


function findPosY(obj) {
    var curtop = 0;
    if (obj.offsetParent) {
        while (1) {
            curtop+=obj.offsetTop;
            if (!obj.offsetParent) {
                break;
            }
            obj=obj.offsetParent;
        }
    } else if (obj.y) {
        curtop+=obj.y;
    }
    return curtop;
}


function makeHttpRequest(URL, ElementId) {
	var s = document.getElementById(ElementId);
	var http_request = false;

	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) { }
		}
	}

   	if (!http_request) {
   		alert('Unfortunatelly you browser doesn\'t support this feature.');
   		return false;
   	}
   	http_request.onreadystatechange = function() {
   		if (http_request.readyState == 4) {
   			if (http_request.status == 200) {
   				LoadContents(http_request.responseText, ElementId);
   			} else {
   				//alert('There was a problem with the request.(Code: ' + http_request.status + ')');
   			}
   		}
   	}

   	var obj = document.getElementById(ElementId);
   	obj.innerHTML = "<p align=center><img src=\"Images/rotation1.gif\"></p>";
   	http_request.open('GET', URL, true);
   	http_request.send(null);
}

function LoadContents(sHTML, ElementId) {
	var obj = document.getElementById(ElementId);
	obj.innerHTML = sHTML;
}


function AddToCart(productId, divid) {
	makeHttpRequest("AddToCart_Ajax.aspx?sid=" + Math.random()+"&ProductId="+productId, "BasketItems");
	
	
	ShowAlert(divid);
}

function AddToCartQuantity(productId, quantity, divid) {
	makeHttpRequest("AddToCart_Ajax.aspx?sid=" + Math.random() + "&ProductId=" + productId + "&Quantity=" + quantity, "BasketItems");
	
	
	ShowAlert(divid);
}

function ShowAlert(divid) {

		var moveX = 120;
		var moveY = 0;

		if(divid.indexOf("MiscCategoryBox")>=0) {
			moveX = 0;
			moveY = 10;
		} else if(divid.indexOf("Stamoulis")>=0) {
			moveX = -20;
			moveY = 80;
		} else if(divid.indexOf("List")>=0) {
			moveX = 210;
			moveY = -100;
        } else if (divid.indexOf("Product") >= 0) {
            moveX = 0;
            moveY = -110;
        } 
			
		var imgPosX = MyfindPosX(document.getElementById(divid));
		var imgPosY = MyfindPosY(document.getElementById(divid));
			
		var noPx = document.childNodes ? 'px' : 0;
			
		document.getElementById("mc_alert").style.left = (imgPosX + moveX)+ noPx;
		document.getElementById("mc_alert").style.top = (imgPosY + moveY)+ noPx;
        document.getElementById("mc_alert").style.visibility = 'visible';
}


function MyfindPosX(obj) {
    var curleft = 0;

    if (obj.offsetParent) {
        while (1) {
            curleft+=obj.offsetLeft;
            if (!obj.offsetParent) {
                break;
            }
            obj=obj.offsetParent;
        }
    } else if (obj.x) {
        curleft+=obj.x;
    }
    return curleft;
}
function MyfindPosY(obj) {
    var curtop = 0;
    if (obj.offsetParent) {
        while (1) {
            curtop+=obj.offsetTop;
            if (!obj.offsetParent) {
                break;
            }
            obj=obj.offsetParent;
        }
    } else if (obj.y) {
        curtop+=obj.y;
    }
    return curtop;
}


function HideAlert(divid) {
	document.getElementById(divid).style.visibility = 'hidden';
}


function ShowPopupCarousel(productId, pos, total){
	imgPosX = findPosX_car('image_'+productId);
	imgPosY = findPosY_car('image_'+productId);

	
	var noPx = document.childNodes ? 'px' : 0;
	
	/*document.getElementById("pop_"+productId).style.left = (imgPosX + 30)+ noPx;
	document.getElementById("pop_"+productId).style.top = (imgPosY + 5)+ noPx;*/

	document.getElementById("pop_"+productId).style.visibility = 'visible';

	var myWidth = alertSize();
	var extraleft = 0;
	if (myWidth <= 1000) {
	    extraleft = 200;
	}  else {
	    extraleft = (myWidth * 29.4) / 100;
	    if (myWidth < 1280)
	        extraleft += 10;
	}

	if (total%4!=0 && total - pos < 3)
	    pos = total - pos;
	var leftOffset = (pos % 4) * 159 + extraleft;
	if(pos%4==0)
		leftOffset = leftOffset+5;
	document.getElementById("pop_"+productId).style.left = leftOffset+'px';
	document.getElementById("pop_"+productId).style.top = '380px';
}

function HidePopupCarousel(productId){
		
	document.getElementById("pop_"+productId).style.visibility = 'hidden';

}



function SetVisible(divid, visibility) {
	document.getElementById(divid).style.visibility = visibility;

}
function findPosX_car(obj) {
    var curleft = 0;
    if (obj.offsetParent) {
        while (1) {
            curleft+=obj.offsetLeft;
            if (!obj.offsetParent) {
                break;
            }
            obj=obj.offsetParent;
        }
    } else if (obj.x) {
        curleft+=obj.x;
    }
    return curleft;
}
function findPosY_car(obj) {
    var curtop = 0;
    if (obj.offsetParent) {
        while (1) {
            curtop+=obj.offsetTop;
            if (!obj.offsetParent) {
                break;
            }
            obj=obj.offsetParent;
        }
    } else if (obj.y) {
        curtop+=obj.y;
    }
    return curtop;
}



function alertSize() {
    var myWidth = 0, myHeight = 0;
    if (typeof (window.innerWidth) == 'number') {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
    return myWidth;
}


function MM_swapImgRestore() { //v3.0
    var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}

function MM_findObj(n, d) { //v4.01
    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
    var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
        if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
    }


function Count_Length() {
    if (document.Search.Title.value.length == 0) {
        uncheck('SearchType');
        uncheck('BooleanSearch');
    }
}

function uncheck(oRadio) {
    var or = document.getElementsByName(oRadio);
    for (var i = 0; i < or.length; i++) {
        or[i].checked = false;
    }
}
