// #########  code from js/hm1.js   ######### //

var mf_wall_x = 1010;
var mf_wall_y = 5;
var mf_wall_center = false;

function mf_wall_init(top) {
    if ( document.getElementById('eBayRelevanceSky') ) {
        document.getElementById('eBayRelevanceSky').style.display = 'none';
    }
}

function detectBrowser()
{
	var browser=navigator.appName;
	var b_version=navigator.appVersion;
	var version=parseFloat(b_version);
	
	return browser;
	/*
	if ((browser=="Netscape"||browser=="Microsoft Internet Explorer")
	&& (version>=4))
	{
		alert("Your browser is good enough!");
	}
	else
	{
		alert("It's time to upgrade your browser!");
	}
	*/
}


// #########  code from js/filter.js   ######### //

function switch_display(id) {
	all_elements = getElementsByClassName("f_" + id);
	more = document.getElementById("more_" + id);	// "More filter" part
	less = document.getElementById("less_" + id);	// "Less filter" part

	if (all_elements[0]) {
		var elem_0 = all_elements[0];
		if (elem_0 && (elem_0.style.display == "block" || elem_0.style.display == "")) {
			var display = "none";
			var display_inv = "";
		} else {
			var display = "";
			var display_inv = "none";
		}
		for (var i = 0; i < all_elements.length; i++) {
			obj = all_elements[i];
			obj.style.display = display;
		}
		more.style.display = display_inv;
		less.style.display = display;
	}
}
function getElementsByClassName(classname) {
	all_elements = document.getElementById("filter").getElementsByTagName("tr");
	return_array = new Array();
	for(var i = 0; i < all_elements.length; i++) {
		if (i < 20) {
		}
		if (all_elements[i].className == classname) {
			return_array = return_array.concat(all_elements[i]);
		}
	}
	return(return_array);
}


// #########  code from js/animatedcollapse.js   ######### //

function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function overlay(curobj, subobjstr, opt_position,left,top){
if (document.getElementById){
	
	if(subobjstr == "subcontent_login") {
		if(chkObject('subcontent')){
			if(document.getElementById('subcontent').style.display == "block") {
				document.getElementById('subcontent').style.display="none";
			}
		}
	} else {
		if(chkObject('subcontent_login')){
			if(document.getElementById('subcontent_login').style.display == "block") {
				document.getElementById('subcontent_login').style.display="none";
			}
		}		
	}
	
var subobj=document.getElementById(subobjstr)
subobj.style.display=(subobj.style.display!="block")? "block" : "none"
var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) - left;
var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=100)? curobj.offsetHeight : 0) + top;
//alert(xpos + " : " + ypos);
subobj.style.left=xpos+"px"
subobj.style.top=ypos+"px"
return false
}
else
return true
}

function overlayopen(subobjstr){
	var subobj=document.getElementById(subobjstr)
	subobj.style.display=(subobj.style.display!="block")? "block" : "none"
}


function overlayclose(subobj){
document.getElementById(subobj).style.display="none"
}

function chkObject(theVal) {
		if (document.getElementById(theVal) != null) {
			return true;
		} else {
			return false;
		}
}


var menuTimer = 0;
/*function open_timedMenu(menuName, openTime)
{
  clearTimeout(menuTimer);
  var functionStr = "ShowHideLeft('" + menuName + "')";
  menuTimer = setTimeout(functionStr, openTime);
}*/


// #########  code from js/common.js   ######### //


/**
 * COMMON DHTML FUNCTIONS
 * These are handy functions I use all the time.
 *
 * By Seth Banks (webmaster at subimage dot com)
 * http://www.subimage.com/
 *
 * Up to date code can be found at http://www.subimage.com/dhtml/
 *
 * This code is free for you to use anywhere, just keep this comment block.
 */

/**
 * X-browser event handler attachment and detachment
 * TH: Switched first true to false per http://www.onlinetools.org/articles/unobtrusivejavascript/chapter4.html
 *
 * @argument obj - the object to attach event to
 * @argument evType - name of the event - DONT ADD "on", pass only "mouseover", etc
 * @argument fn - function to call
 */
function addEvent(obj, evType, fn){
 if (obj.addEventListener){
    obj.addEventListener(evType, fn, false);
    return true;
 } else if (obj.attachEvent){
    var r = obj.attachEvent("on"+evType, fn);
    return r;
 } else {
    return false;
 }
}
function removeEvent(obj, evType, fn, useCapture){
  if (obj.removeEventListener){
    obj.removeEventListener(evType, fn, useCapture);
    return true;
  } else if (obj.detachEvent){
    var r = obj.detachEvent("on"+evType, fn);
    return r;
  } else {
    alert("Handler could not be removed");
  }
}

/**
 * Code below taken from - http://www.evolt.org/article/document_body_doctype_switching_and_more/17/30655/
 *
 * Modified 4/22/04 to work with Opera/Moz (by webmaster at subimage dot com)
 *
 * Gets the full width/height because it's different for most browsers.
 */
function getViewportHeight() {
	if (window.innerHeight!=window.undefined) return window.innerHeight;
	if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
	if (document.body) return document.body.clientHeight; 

	return window.undefined; 
}
function getViewportWidth() {
	var offset = 17;
	var width = null;
	if (window.innerWidth!=window.undefined) return window.innerWidth; 
	if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth; 
	if (document.body) return document.body.clientWidth; 
}

/**
 * Gets the real scroll top
 */
function getScrollTop() {
	if (self.pageYOffset) // all except Explorer
	{
		return self.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		return document.documentElement.scrollTop;
	}
	else if (document.body) // all other Explorers
	{
		return document.body.scrollTop;
	}
}
function getScrollLeft() {
	if (self.pageXOffset) // all except Explorer
	{
		return self.pageXOffset;
	}
	else if (document.documentElement && document.documentElement.scrollLeft)
		// Explorer 6 Strict
	{
		return document.documentElement.scrollLeft;
	}
	else if (document.body) // all other Explorers
	{
		return document.body.scrollLeft;
	}
}



function priceValidate(min,max) {
	var x=document.filter_price;

	for(i=0; i<document.filter_price.elements.length; i++)
	{
		if( document.filter_price.elements[i].type == "text" || document.filter_price.elements[i].type == "password" || document.filter_price.elements[i].type == "textarea" )
		{ document.filter_price.elements[i].value  = trim(document.filter_price.elements[i].value); }
	}
	
	if(x.min.value != "")
	{
		var tel1 = x.min.value;
		ret = numCheck(tel1,'Invalid From Price Value.');
		if(ret == 1)
		{x.min.focus();return false;}
		
		if(parseInt(x.min.value) < parseInt(min)){
			//alert("The From price cannot be less then "+min);
			//x.min.focus();
			//return false;	
			x.min.value = min;
		}

		if(parseInt(x.min.value) > parseInt(max)){
			//alert("The From price cannot be greater then "+max);
			//x.min.focus();
			//return false;	
			x.min.value = min;
		}

	}	


	if(x.max.value != "")
	{
		var tel1 = x.max.value;
		ret = numCheck(tel1,'Invalid To Price value');
		if(ret == 1)
		{x.max.focus();return false;}
		
		if(parseInt(x.max.value) > parseInt(max)){
			//alert("The To price cannot be greater then "+max);
			//x.max.focus();
			//return false;	
			x.max.value = max;
		}
		
		if(parseInt(x.max.value) < parseInt(min)){
			//alert("The To price cannot be less then "+min);
			//x.max.focus();
			//return false;	
			x.max.value = max;
		}		
		
	}
	x.submit();
}

function trim(s)
{
  return s.replace(/^\s*|\s*$/g,"");
}


function numCheck(tel,msg,focus)
{
	for (var i = 0; i < tel.length; i++)
	{
		var ch = tel.substring(i, i+1);
		if(ch < '0' || ch > '9' )
		{

				alert(msg);
				return 1;
		}
	}
}//end of numCheck function



// #########  code from js/subModal.js   ######### //

/**
 * SUBMODAL v1.5
 * Used for displaying DHTML only popups instead of using buggy modal windows.
 *
 * By Seth Banks
 * http://www.subimage.com/
 *
 * Contributions by:
 * 	Eric Angel - tab index code
 * 	Scott - hiding/showing selects for IE users
 *	Todd Huss - inserting modal dynamically and anchor classes
 *
 * Up to date code can be found at http://www.subimage.com/dhtml/subModal
 * 
 *
 * This code is free for you to use anywhere, just keep this comment block.
 */

// Popup code
var gPopupMask = null;
var gPopupContainer = null;
var gPopFrame = null;
var gReturnFunc;
var gPopupIsShown = false;
var gDefaultPage = "loading.html";
var gHideSelects = true;
var gReturnVal = null;

var gTabIndexes = new Array();
// Pre-defined list of tags we want to disable/enable tabbing into
var gTabbableTags = new Array("A","BUTTON","TEXTAREA","INPUT","IFRAME");	

// If using Mozilla or Firefox, use Tab-key trap.
if (!document.all) {
	document.onkeypress = keyDownHandler;
}

/**
 * Initializes popup code on load.	
 */
function initPopUp() {
	// Add the HTML to the body
	theBody = document.getElementsByTagName('BODY')[0];
	popmask = document.createElement('div');
	popmask.id = 'popupMask';
	popcont = document.createElement('div');
	popcont.id = 'popupContainer';
	popcont.innerHTML = '' +
		'<div id="popupInner">' +
			'<div id="popupTitleBar">' +
				'<div id="popupTitle"></div>' +
				'<div id="popupControls">' +
					'<img src="images/close_submodal.gif" onclick="hidePopWin(false);" id="popCloseBox" />' +
				'</div>' +
			'</div>' +
			'<iframe src="'+ gDefaultPage +'" style="width:100%;height:100%;background-color:transparent;" scrolling="auto" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame" width="100%" height="100%"></iframe>' +
		'</div>';
	theBody.appendChild(popmask);
	theBody.appendChild(popcont);
	
	gPopupMask = document.getElementById("popupMask");
	gPopupContainer = document.getElementById("popupContainer");
	gPopFrame = document.getElementById("popupFrame");	
	
	// check to see if this is IE version 6 or lower. hide select boxes if so
	// maybe they'll fix this in version 7?
	var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10);
	if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE") > -1) {
		gHideSelects = true;
	}
	
	// Add onclick handlers to 'a' elements of class submodal or submodal-width-height
	var elms = document.getElementsByTagName('a');
	for (i = 0; i < elms.length; i++) {
		if (elms[i].className.indexOf("submodal") == 0) { 
			// var onclick = 'function (){showPopWin(\''+elms[i].href+'\','+width+', '+height+', null);return false;};';
			// elms[i].onclick = eval(onclick);
			elms[i].onclick = function(){
				// default width and height
				var width = 400;
				var height = 200;
				// Parse out optional width and height from className
				params = this.className.split('-');
				if (params.length == 3) {
					width = parseInt(params[1]);
					height = parseInt(params[2]);
				}
				showPopWin(this.href,width,height,null); return false;
			}
		}
	}
}
addEvent(window, "load", initPopUp);

 /**
	* @argument width - int in pixels
	* @argument height - int in pixels
	* @argument url - url to display
	* @argument returnFunc - function to call when returning true from the window.
	* @argument showCloseBox - show the close box - default true
	*/

function showPopWin(url, width, height, returnFunc, showCloseBox) {
	// show or hide the window close widget
	if (showCloseBox == null || showCloseBox == true) {
		document.getElementById("popCloseBox").style.display = "none";
	} else {
		document.getElementById("popCloseBox").style.display = "none";
	}
	gPopupIsShown = true;
	disableTabIndexes();
	gPopupMask.style.display = "block";
	gPopupContainer.style.display = "block";
	// calculate where to place the window on screen
	centerPopWin(width, height);
	
	var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10);

	gPopupContainer.style.width = width + "px";
	gPopupContainer.style.height = (height+titleBarHeight) + "px";
	
	setMaskSize();

	// need to set the width of the iframe to the title bar width because of the dropshadow
	// some oddness was occuring and causing the frame to poke outside the border in IE6
	gPopFrame.style.width = parseInt(document.getElementById("popupTitleBar").offsetWidth, 10) + "px";
	gPopFrame.style.height = (height) + "px";
	
	// set the url
	gPopFrame.src = url;
	
	gReturnFunc = returnFunc;
	// for IE
	if (gHideSelects == true) {
		hideSelectBoxes();
	}
	
	window.setTimeout("setPopTitle();", 600);
	
	
}

//
var gi = 0;
function centerPopWin(width, height) {
	if (gPopupIsShown == true) {
		if (width == null || isNaN(width)) {
			width = gPopupContainer.offsetWidth;
		}
		if (height == null) {
			height = gPopupContainer.offsetHeight;
		}
		
		//var theBody = document.documentElement;
		var theBody = document.getElementsByTagName("BODY")[0];
		//theBody.style.overflow = "hidden";
		var scTop = parseInt(getScrollTop(),10);
		var scLeft = parseInt(theBody.scrollLeft,10);
	
		setMaskSize();
		
		//window.status = gPopupMask.style.top + " " + gPopupMask.style.left + " " + gi++;
		
		var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10);
		
		var fullHeight = getViewportHeight();
		var fullWidth = getViewportWidth();
		
		gPopupContainer.style.top = (scTop + ((fullHeight - (height+titleBarHeight)) / 2)) + "px";
		gPopupContainer.style.left =  (scLeft + ((fullWidth - width) / 2)) + "px";
		//alert(fullWidth + " " + width + " " + gPopupContainer.style.left);
	}
}
addEvent(window, "resize", centerPopWin);
addEvent(window, "scroll", centerPopWin);
window.onscroll = centerPopWin;


/**
 * Sets the size of the popup mask.
 *
 */
function setMaskSize() {
	var theBody = document.getElementsByTagName("BODY")[0];
			
	var fullHeight = getViewportHeight();
	var fullWidth = getViewportWidth();
	
	// Determine what's bigger, scrollHeight or fullHeight / width
	if (fullHeight > theBody.scrollHeight) {
		popHeight = fullHeight;
	} else {
		popHeight = theBody.scrollHeight;
	}
	
	if (fullWidth > theBody.scrollWidth) {
		popWidth = fullWidth;
	} else {
		popWidth = theBody.scrollWidth;
	}
	
	gPopupMask.style.height = popHeight + "px";
	gPopupMask.style.width = popWidth + "px";
}

/**
 * @argument callReturnFunc - bool - determines if we call the return function specified
 * @argument returnVal - anything - return value 
 */
function hidePopWin(callReturnFunc) {
	gPopupIsShown = false;
	var theBody = document.getElementsByTagName("BODY")[0];
	theBody.style.overflow = "";
	restoreTabIndexes();
	if (gPopupMask == null) {
		return;
	}
	gPopupMask.style.display = "none";
	gPopupContainer.style.display = "none";
	if (callReturnFunc == true && gReturnFunc != null) {
		// Set the return code to run in a timeout.
		// Was having issues using with an Ajax.Request();
		gReturnVal = window.frames["popupFrame"].returnVal;
		window.setTimeout('gReturnFunc(gReturnVal);', 1);
	}
	gPopFrame.src = gDefaultPage;
	// display all select boxes
	if (gHideSelects == true) {
		displaySelectBoxes();
	}
}

/**
 * Sets the popup title based on the title of the html document it contains.
 * Uses a timeout to keep checking until the title is valid.
 */
function setPopTitle() {
	return;
	if (window.frames["popupFrame"].document.title == null) {
		window.setTimeout("setPopTitle();", 10);
	} else {
		document.getElementById("popupTitle").innerHTML = window.frames["popupFrame"].document.title;
	}
}

// Tab key trap. iff popup is shown and key was [TAB], suppress it.
// @argument e - event - keyboard event that caused this function to be called.
function keyDownHandler(e) {
    if (gPopupIsShown && e.keyCode == 9)  return false;
}

// For IE.  Go through predefined tags and disable tabbing into them.
function disableTabIndexes() {
	if (document.all) {
		var i = 0;
		for (var j = 0; j < gTabbableTags.length; j++) {
			var tagElements = document.getElementsByTagName(gTabbableTags[j]);
			for (var k = 0 ; k < tagElements.length; k++) {
				gTabIndexes[i] = tagElements[k].tabIndex;
				tagElements[k].tabIndex="-1";
				i++;
			}
		}
	}
}

// For IE. Restore tab-indexes.
function restoreTabIndexes() {
	if (document.all) {
		var i = 0;
		for (var j = 0; j < gTabbableTags.length; j++) {
			var tagElements = document.getElementsByTagName(gTabbableTags[j]);
			for (var k = 0 ; k < tagElements.length; k++) {
				tagElements[k].tabIndex = gTabIndexes[i];
				tagElements[k].tabEnabled = true;
				i++;
			}
		}
	}
}


/**
* Hides all drop down form select boxes on the screen so they do not appear above the mask layer.
* IE has a problem with wanted select form tags to always be the topmost z-index or layer
*
* Thanks for the code Scott!
*/
function hideSelectBoxes() {
	for(var i = 0; i < document.forms.length; i++) {
		for(var e = 0; e < document.forms[i].length; e++){
			if(document.forms[i].elements[e].tagName == "SELECT") {
				document.forms[i].elements[e].style.visibility="hidden";
			}
		}
	}
}

/**
* Makes all drop down form select boxes on the screen visible so they do not reappear after the dialog is closed.
* IE has a problem with wanted select form tags to always be the topmost z-index or layer
*/
function displaySelectBoxes() {
	for(var i = 0; i < document.forms.length; i++) {
		for(var e = 0; e < document.forms[i].length; e++){
			if(document.forms[i].elements[e].tagName == "SELECT") {
			document.forms[i].elements[e].style.visibility="visible";
			}
		}
	}
}

function showPopWin2(url, width, height, returnFunc, showCloseBox) {
	// show or hide the window close widget
	if (showCloseBox == null || showCloseBox == true) {
		document.getElementById("popCloseBox").style.display = "block";
	} else {
		document.getElementById("popCloseBox").style.display = "none";
	}
	gPopupIsShown = true;
	disableTabIndexes();
	gPopupMask.style.display = "block";

	gPopupMask.onclick = function(){
		// default width and height
		window.parent.location='myprofile.php';
	}


	gPopupContainer.style.display = "block";
	// calculate where to place the window on screen
	centerPopWin(width, height);
	
	var titleBarHeight = "0";


	gPopupContainer.style.display = "none";
	
	setMaskSize();

	// need to set the width of the iframe to the title bar width because of the dropshadow
	// some oddness was occuring and causing the frame to poke outside the border in IE6
	gPopFrame.style.display = "none";
	
	gReturnFunc = returnFunc;
	// for IE
	if (gHideSelects == true) {
		hideSelectBoxes();
	}
	
	window.setTimeout("setPopTitle();", 600);
}

// ######### code from assets/dropdowntabs.js   ######### //

//Drop Down Tabs Menu- Author: Dynamic Drive (http://www.dynamicdrive.com)
//Created: May 16th, 07'

var tabdropdown={
	disappeardelay: 00, //set delay in miliseconds before menu disappears onmouseout
	disablemenuclick: false, //when user clicks on a menu item with a drop down menu, disable menu item's link?
	enableiframeshim: 1, //1 or 0, for true or false

	//No need to edit beyond here////////////////////////
	dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all, previousmenuitem:null,
	currentpageurl: window.location.href.replace("http://"+window.location.hostname, "").replace(/^\//, ""), //get current page url (minus hostname, ie: http://www.dynamicdrive.com/)

	getposOffset:function(what, offsettype){
		var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
		var parentEl=what.offsetParent;
			while (parentEl!=null){
				totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
				parentEl=parentEl.offsetParent;
			}
		return totaloffset;
	},

	showhide:function(obj, e, obj2){ //obj refers to drop down menu, obj2 refers to tab menu item mouse is currently over
		if (this.ie || this.firefox)
			this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px"
		if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
			if (obj2.parentNode.className.indexOf("default")==-1) //if tab isn't a default selected one
				obj2.parentNode.className="selected"
			obj.visibility="visible"
			}
		else if (e.type=="click")
			obj.visibility="hidden"
	},

	iecompattest:function(){
		return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	},

	clearbrowseredge:function(obj, whichedge){
		var edgeoffset=0
		if (whichedge=="rightedge"){
			//var windowedge=this.ie && !window.opera? this.standardbody.scrollLeft+this.standardbody.clientWidth-15 : window.pageXOffset+window.innerWidth-15
			var windowedge=1024;
			this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth
		if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure)  //move menu to the left?
			edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth
		}
		else{
			var topedge=this.ie && !window.opera? this.standardbody.scrollTop : window.pageYOffset
			var windowedge=this.ie && !window.opera? this.standardbody.scrollTop+this.standardbody.clientHeight-15 : window.pageYOffset+window.innerHeight-18
			this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight
			if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up?
				edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight
				if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either?
					edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
			}
			this.dropmenuobj.firstlink.style.borderTopWidth=(edgeoffset==0)? 0 : "1px" //Add 1px top border to menu if dropping up
		}
		return edgeoffset
	},

	dropit:function(obj, e, dropmenuID){
		if (this.dropmenuobj!=null){ //hide previous menu
			this.dropmenuobj.style.visibility="hidden" //hide menu
			if (this.previousmenuitem!=null && this.previousmenuitem!=obj){
				if (this.previousmenuitem.parentNode.className.indexOf("default")==-1) //If the tab isn't a default selected one
					this.previousmenuitem.parentNode.className=""
			}
		}
		this.clearhidemenu()
		if (this.ie||this.firefox){
			obj.onmouseout=function(){tabdropdown.delayhidemenu(obj)}
			obj.onclick=function(){return !tabdropdown.disablemenuclick} //disable main menu item link onclick?
			this.dropmenuobj=document.getElementById(dropmenuID)
			this.dropmenuobj.onmouseover=function(){tabdropdown.clearhidemenu()}
			this.dropmenuobj.onmouseout=function(e){tabdropdown.dynamichide(e, obj)}
			this.dropmenuobj.onclick=function(){tabdropdown.delayhidemenu(obj)}
			this.showhide(this.dropmenuobj.style, e, obj)
			this.dropmenuobj.x=this.getposOffset(obj, "left")
			this.dropmenuobj.y=this.getposOffset(obj, "top")
			this.dropmenuobj.style.left="200px"
			
			//this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px"
			
			this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+0+"px"
			this.previousmenuitem=obj //remember main menu item mouse moved out from (and into current menu item)
			this.positionshim() //call iframe shim function
		}

	},

	contains_firefox:function(a, b) {
	if(b != null)
	{
		while (b.parentNode)
		if ((b = b.parentNode) == a)
			return true;
		}	
		return false;
	},

	dynamichide:function(e, obj2){ //obj2 refers to tab menu item mouse is currently over
		var evtobj=window.event? window.event : e
		if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
			this.delayhidemenu(obj2)
		else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
			this.delayhidemenu(obj2)
	},

	delayhidemenu:function(obj2){
		this.delayhide=setTimeout(function(){tabdropdown.dropmenuobj.style.visibility='hidden'; if (obj2.parentNode.className.indexOf('default')==-1) obj2.parentNode.className=''},this.disappeardelay) //hide menu
	},

	clearhidemenu:function(){
		if (this.delayhide!="undefined")
			clearTimeout(this.delayhide)
	},

	positionshim:function(){ //display iframe shim function
		if (this.enableiframeshim && typeof this.shimobject!="undefined"){
			if (this.dropmenuobj.style.visibility=="visible"){
				this.shimobject.style.width=this.dropmenuobj.offsetWidth+"px"
				this.shimobject.style.height=this.dropmenuobj.offsetHeight+"px"
				this.shimobject.style.left=this.dropmenuobj.style.left
				this.shimobject.style.top=this.dropmenuobj.style.top
			}
		this.shimobject.style.display=(this.dropmenuobj.style.visibility=="visible")? "block" : "none"
		}
	},

	hideshim:function(){
		if (this.enableiframeshim && typeof this.shimobject!="undefined")
			this.shimobject.style.display='none'
	},

isSelected:function(menuurl){
	var menuurl=menuurl.replace("http://"+menuurl.hostname, "").replace(/^\//, "")
	return (tabdropdown.currentpageurl==menuurl)
},

	init:function(menuid, dselected){
		this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
		var menuitems=document.getElementById(menuid).getElementsByTagName("td")
		//					menuitems[i].style.backgroundColor="#DD4814";
		for (var i=0; i<menuitems.length; i++){
			if (menuitems[i].getAttribute("rel")){
				var relvalue=menuitems[i].getAttribute("rel")

				document.getElementById(relvalue).firstlink=document.getElementById(relvalue).getElementsByTagName("td")[0];
				
				menuitems[i].onmouseover=function(e){
					var event=typeof e!="undefined"? e : window.event
					tabdropdown.dropit(this, event, this.getAttribute("rel"))
				}
			}
			if (dselected=="auto" && typeof setalready=="undefined" && this.isSelected(menuitems[i].href)){
				menuitems[i].parentNode.className+=" selected default"
				var setalready=true
			}
			else if (parseInt(dselected)==i)
				menuitems[i].parentNode.className+=" selected default"
		}
	}

}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		but_01_over = newImage("images/but_01-over.gif");
		but_01_but_02_over = newImage("images/but_01-but_02_over.gif");
		but_02_but_01_over = newImage("images/but_02-but_01_over.gif");
		but_02_over = newImage("images/but_02-over.gif");
		but_02_but_03_over = newImage("images/but_02-but_03_over.gif");
		but_03_but_02_over = newImage("images/but_03-but_02_over.gif");
		but_03_over = newImage("images/but_03-over.gif");
		preloadFlag = true;
	}
}

// Title: Tigra Form Validator
// URL: http://www.softcomplex.com/products/tigra_form_validator/
// Version: 1.3
// Date: 08/25/2005 (mm/dd/yyyy)
// Notes: Registration needed to use this script legally. Visit official site for details.
//'text': /^\w+\s*/,
// regular expressions or function to validate the format
var re_dt = /^(\d{1,2})\-(\d{1,2})\-(\d{4})$/,
re_tm = /^(\d{1,2})\:(\d{1,2})\:(\d{1,2})$/,
a_formats = {
	'alpha'   : /^[a-zA-Z\.\-]*$/,
	'alphanum': /^\w+$/,
	'alphaphone': /^[0-9\.\-]*$/,
	'text'	  : /^\w+\s*/,
	'unsigned': /^\d+$/,
	'integer' : /^[\+\-]?\d*$/,
	'real'    : /^[\+\-]?\d*\.?\d*$/,
	'email'   : /^[\w-\.]+\@[\w\.-]+\.[a-z]{2,4}$/,
	'phone'   : /^[\d\.\s\-]+$/,
	'date'    : function (s_date) {
		// check format
		if (!re_dt.test(s_date))
			return false;
		// check allowed ranges	
		if (RegExp.$1 > 31 || RegExp.$2 > 12)
			return false;
		// check number of day in month
		var dt_test = new Date(RegExp.$3, Number(RegExp.$2-1), RegExp.$1);
		if (dt_test.getMonth() != Number(RegExp.$2-1))
			return false;
		return true;
	},
	'time'    : function (s_time) {
		// check format
		if (!re_tm.test(s_time))
			return false;
		// check allowed ranges	
		if (RegExp.$1 > 23 || RegExp.$2 > 59 || RegExp.$3 > 59)
			return false;
		return true;
	}
},
a_messages = [
	'No form name passed to validator construction routine',
	'No array of "%form%" form fields passed to validator construction routine',
	'Form "%form%" can not be found in this document',
	'Incomplete "%n%" form field descriptor entry. "l" attribute is missing',
	'Can not find form field "%n%" in the form "%form%"',
	'Can not find label tag (id="%t%")',
	'Can not verify match. Field "%m%" was not found',
	'"%l%" is required',
	'"%l%" has to be at least %mn% characters long.',
	'"%l%" my not be longer than %mx% characters',
	'Please use only numbers and letters.',	
	'The password is not correct. Please try again.'
]

//"%v%" is not a correct value for "%l%"		incorect password value eg fashion.de
//'"%l%" muß passen zu "%ml%"'

// validator counstruction routine
function validator(s_form, a_fields, o_cfg) {
	this.f_error = validator_error;
	this.f_alert = o_cfg && o_cfg.alert
		? function(s_msg) { alert(s_msg); return false }
		: function() { return false };
		
	// check required parameters
	if (!s_form)	
		return this.f_alert(this.f_error(0));
	this.s_form = s_form;
	
	if (!a_fields || typeof(a_fields) != 'object')
		return this.f_alert(this.f_error(1));
	this.a_fields = a_fields;

	this.a_2disable = o_cfg && o_cfg['to_disable'] && typeof(o_cfg['to_disable']) == 'object'
		? o_cfg['to_disable']
		: [];
		
	this.exec = validator_exec;
}

// validator execution method
function validator_exec() {
	var o_form = document.forms[this.s_form];
	if (!o_form)	
		return this.f_alert(this.f_error(2));
		
	b_dom = document.body && document.body.innerHTML;
	
	// check integrity of the form fields description structure
	for (var n_key in this.a_fields) {
		// check input description entry
		this.a_fields[n_key]['n'] = n_key;
		if (!this.a_fields[n_key]['l'])
			return this.f_alert(this.f_error(3, this.a_fields[n_key]));
		o_input = o_form.elements[n_key];
		if (!o_input)
			return this.f_alert(this.f_error(4, this.a_fields[n_key]));
		this.a_fields[n_key].o_input = o_input;
	}

	// reset labels highlight
	if (b_dom)
		for (var n_key in this.a_fields) 
			if (this.a_fields[n_key]['t']) {
				var s_labeltag = this.a_fields[n_key]['t'], e_labeltag = get_element(s_labeltag);
				if (!e_labeltag)
					return this.f_alert(this.f_error(5, this.a_fields[n_key]));
				this.a_fields[n_key].o_tag = e_labeltag;
				
				// normal state parameters assigned here
				e_labeltag.className = 'tfvNormal';
			}

	// collect values depending on the type of the input
	for (var n_key in this.a_fields) {
		var s_value = '';
		o_input = this.a_fields[n_key].o_input;
		if (o_input.type == 'checkbox') // checkbox
			s_value = o_input.checked ? o_input.value : '';
		else if (o_input.value) // text, password, hidden
			s_value = o_input.value;
		else if (o_input.options) // select
			s_value = o_input.selectedIndex > -1
				? o_input.options[o_input.selectedIndex].value
				: null;
		else if (o_input.length > 0) // radiobuton
			for (var n_index = 0; n_index < o_input.length; n_index++)
				if (o_input[n_index].checked) {
					s_value = o_input[n_index].value;
					break;
				}
		this.a_fields[n_key]['v'] = s_value.replace(/(^\s+)|(\s+$)/g, '');
	}
	
	// check for errors
	var n_errors_count = 0,
		n_another, o_format_check;
	for (var n_key in this.a_fields) {
		o_format_check = this.a_fields[n_key]['f'] && a_formats[this.a_fields[n_key]['f']]
			? a_formats[this.a_fields[n_key]['f']]
			: null;

		// reset previous error if any
		this.a_fields[n_key].n_error = null;

		// check reqired fields
		if (this.a_fields[n_key]['r'] && !this.a_fields[n_key]['v']) {
			this.a_fields[n_key].n_error = 1;
			n_errors_count++;
		}
		// check length
		else if (this.a_fields[n_key]['mn'] && this.a_fields[n_key]['v'] != '' && String(this.a_fields[n_key]['v']).length < this.a_fields[n_key]['mn']) {
			this.a_fields[n_key].n_error = 2;
			n_errors_count++;
		}
		else if (this.a_fields[n_key]['mx'] && String(this.a_fields[n_key]['v']).length > this.a_fields[n_key]['mx']) {
			this.a_fields[n_key].n_error = 3;
			n_errors_count++;
		}
		// check format
		else if (this.a_fields[n_key]['v'] && this.a_fields[n_key]['f'] && (
			(typeof(o_format_check) == 'function'
			&& !o_format_check(this.a_fields[n_key]['v']))
			|| (typeof(o_format_check) != 'function'
			&& !o_format_check.test(this.a_fields[n_key]['v'])))
			) {
			this.a_fields[n_key].n_error = 4;
			n_errors_count++;
		}
		// check match	
		else if (this.a_fields[n_key]['m']) {
			for (var n_key2 in this.a_fields)
				if (n_key2 == this.a_fields[n_key]['m']) {
					n_another = n_key2;
					break;
				}
			if (n_another == null)
				return this.f_alert(this.f_error(6, this.a_fields[n_key]));
			if (this.a_fields[n_another]['v'] != this.a_fields[n_key]['v']) {
				this.a_fields[n_key]['ml'] = this.a_fields[n_another]['l'];
				this.a_fields[n_key].n_error = 5;
				n_errors_count++;
			}
		}
		
	}

	// collect error messages and highlight captions for errorneous fields
	var s_alert_message = '',
		e_first_error;

	if (n_errors_count) {
		for (var n_key in this.a_fields) {
			var n_error_type = this.a_fields[n_key].n_error,
				s_message = '';
				
			if (n_error_type)
				s_message = this.f_error(n_error_type + 6, this.a_fields[n_key]);

			if (s_message) {
				if (!e_first_error)
					e_first_error = o_form.elements[n_key];
				s_alert_message += s_message + "\n";
				// highlighted state parameters assigned here
				if (b_dom && this.a_fields[n_key].o_tag)
					this.a_fields[n_key].o_tag.className = 'tfvHighlight';
			}
		}
		alert(s_alert_message);
		// set focus to first errorneous field
		if (e_first_error.focus && e_first_error.type != 'hidden'  && !e_first_error.disabled)
			eval("e_first_error.focus()");
		// cancel form submission if errors detected
		return false;
	}
	
	for (n_key in this.a_2disable)
		if (o_form.elements[this.a_2disable[n_key]])
			o_form.elements[this.a_2disable[n_key]].disabled = true;

	return true;
}

function validator_error(n_index) {
	var s_ = a_messages[n_index], n_i = 1, s_key;
	for (; n_i < arguments.length; n_i ++)
		for (s_key in arguments[n_i])
			s_ = s_.replace('%' + s_key + '%', arguments[n_i][s_key]);
	s_ = s_.replace('%form%', this.s_form);
	return s_
}

function get_element (s_id) {
	return (document.all ? document.all[s_id] : (document.getElementById ? document.getElementById(s_id) : null));
}

function trim(s)
{
  return s.replace(/^\s*|\s*$/g,"");
}

function checkEnter(e){
	var characterCode

	if(e && e.which){
	e = e
	characterCode = e.which 
	}
	else{
	e = event
	characterCode = e.keyCode 
	}

	if(characterCode == 13){ 
		document.search.submit()
		return false 
	}
	else{
	return true 
	}

}

function load_page(page){
	window.location.href=page;

}

function chgtxt(obj,linkid,linkcolor)
{
	if(document.getElementById) // IE5+ and NS6+ only
	{
		document.getElementById(linkid).style.color=linkcolor
	}
}


// #########  code from assets/anylinkvertical.js   ######### //

var disappeardelay=0  //menu disappear speed onMouseout (in miliseconds)
var enableanchorlink=0 //Enable or disable the anchor link when clicked on? (1=e, 0=d)
var hidemenu_onclick=1 //hide menu when user clicks within menu? (1=yes, 0=no)
var horizontaloffset=0 //horizontal offset of menu from default location. (0-5 is a good value)

/////No further editting needed

var ie5=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function showhide(obj, e, visible, hidden){
if (ie5||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie5 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x-obj.offsetWidth < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+(horizontaloffset*2) //no space to the right of page? Move menu over to the left
}
else{
var topedge=ie5 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move menu up?
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either? (position at top of viewable window then)
edgeoffset=dropmenuobj.y
}
}
return edgeoffset
}

function dropdownmenu(obj, e, dropmenuID){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
if (typeof dropmenuobj!="undefined") //hide previous menu
dropmenuobj.style.visibility="hidden"
clearhidemenu()
if (ie5||ns6){
obj.onmouseout=delayhidemenu
dropmenuobj=document.getElementById(dropmenuID)
if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.visibility='hidden'}
dropmenuobj.onmouseover=clearhidemenu
dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)}
showhide(dropmenuobj.style, e, "visible", "hidden")
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.x=dropmenuobj.x-3;
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+horizontaloffset+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
}
return clickreturnvalue()
}

function clickreturnvalue(){
if ((ie5||ns6) && !enableanchorlink) return false
else return true
}

function contains_ns6(a, b) {
if(b != "")
{
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
}
return false;
}

function dynamichide(e){
if (ie5&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("dropmenuobj.style.visibility='hidden'",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}


// #########  code from js/meta.js   ######### //

function setFocus()
{
var field = document.top_search.keyword;
field.focus();
field.select();
}
function IESelectionSend()
{
	if ( (event.which && event.which == 13) || (event.keyCode && event.keyCode == 13) ) {
	    show_loading_indicator();
    	document.top_search_form_id.submit();return false;
    } else {
    	return true;
    }

}
function FirefoxSelectionSend(myfield,e)
     {
     var keycode;
     if (window.event) keycode = window.event.keyCode;
     else if (e) keycode = e.which;
     else return true;

     if (keycode == 13)
        {
        show_loading_indicator();
        myfield.form.submit();
        return false;
        }
     else
     {
      return true;

     }
}
function SetElementProperty(elemId, property, value)
{
	var elem = null;

	if(typeof(elemId) == "object")
		elem = elemId;
	else
		elem = document.getElementById(elemId);

	if((elem != null) && (elem.style != null))
	{
		elem = elem.style;
		elem[property] = value;
	}
}
function submitNewsletter()
{
	var newsletter_email = document.getElementById("newsletter_email").value;
	if( ! isValidEmail (newsletter_email)){
		alert(valid_email_address);
		document.getElementById("newsletter_email").focus();
	} else {
		var url = "process.php";
		var params = "mode=subscribeNewsletter&email="+escape(newsletter_email);
		var response = AjaxAgent.call(url,"","",params);
		alert(response);
	}
}
function submitNewsletter_contactform()
{
	var newsletter_email = document.getElementById("newsletter_email_contact").value;
	if( ! isValidEmail (newsletter_email)){
		alert(valid_email_address);
		document.getElementById("newsletter_email_contact").focus();
	} else {
		var url = "process.php";
		var params = "mode=subscribeNewsletter&email="+escape(newsletter_email);
		var response = AjaxAgent.call(url,"","",params);
		alert(response);
	}
}

function isValidEmail(s)
{
  var re = new RegExp ("^([a-zA-Z0-9_\\-\\.]+)@"
    + "((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)"
    + "|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$");
  return s.match ( re ) != null;
}


function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		but_01_over = newImage(Tbut_01_over);
		but_01_but_02_over = newImage(Tbut_01_but_02_over);
		but_02_but_01_over = newImage(Tbut_02_but_01_over);
		but_02_over = newImage(Tbut_02_over);
		but_02_but_03_over = newImage(Tbut_02_but_03_over);
		but_03_but_02_over = newImage(Tbut_03_but_02_over);
		but_03_over = newImage(Tbut_03_over);
		loading_small = newImage("images/loading_small.gif");
		loading_small = newImage('images/loading.gif');

		icon_mk_over = newImage("images/note_pad.inside.jpg");

		preloadFlag = true;
	}

}

function showLogoTip(){
	var url = "process.php";
	var params = "mode=showlogopopup";
	var showProductDetail = AjaxAgent.call(url,"","",params);

	document.getElementById("overDiv").innerHTML = showProductDetail;
	SetElementProperty('overDiv', 'display', 'block');
	SetElementProperty('logoframe', 'display', 'block');
}

function hideLogoTip(){
	SetElementProperty('overDiv', 'display', 'none');
	SetElementProperty('logoframe', 'display', 'none');
}
function getheight() {
	if(document.getElementById("OnTopBanner")!=null)
	{
			var theDiv = document.getElementById("OnTopBanner");
			var dheight = theDiv.offsetHeight;
			var newheight = parseInt(dheight);

			var iframe1 = document.getElementById("cover_23_a");
			iframe1.style.top = parseInt(120+newheight)+"px";

			var iframe2 = document.getElementById("cover_24_a");
			iframe2.style.top = parseInt(120+newheight)+"px";

			var iframe3 = document.getElementById("cover_25_a");
			iframe3.style.top = parseInt(120+newheight)+"px";

			var iframe4 = document.getElementById("cover_26_a");
			iframe4.style.top = parseInt(120+newheight)+"px";

			var iframe5 = document.getElementById("cover_27_a");
			iframe5.style.top = parseInt(120+newheight)+"px";

			var iframe6 = document.getElementById("cover_28_a");
			iframe6.style.top = parseInt(120+newheight)+"px";

			var iframe6 = document.getElementById("cover_29_a");
			iframe6.style.top = parseInt(120+newheight)+"px";

			var iframe6 = document.getElementById("cover_30_a");
			iframe6.style.top = parseInt(120+newheight)+"px";

			var iframe6 = document.getElementById("cover_31_a");
			iframe6.style.top = parseInt(120+newheight)+"px";

			var iframe6 = document.getElementById("cover_32_a");
			iframe6.style.top = parseInt(120+newheight)+"px";

	}
}

function BookmarkStats(burl, title, siteid)
{
	var url = "process.php";
	var params = "mode=BookmarkStats&URL="+burl+"&TITLE="+title+"&SITE_ID="+siteid;
	//alert(params);
	AjaxAgent.call(url,"","BookmarkStatsResponse",params);
}
function BookmarkStatsResponse(output)
{}


// #########  code from js/functions.js   ######### //



function writestyle(platform)
	{
	
	}

if (navigator.appVersion.indexOf("Mac") != -1 )
	{
    writestyle("mac")
	}
else
	{
    writestyle("pc")
	}

function MM_reloadPage(init)	//reloads the window if Nav4 resized
	{
  	if (init==true) with (navigator)
  		{
		if ((appName=="Netscape")&&(parseInt(appVersion)==4))
			{
    		document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage;
			}
		}
  	else if(innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
	}
MM_reloadPage(true);

function emailCheck (emailStr) 
	{
	/* The following variable tells the rest of the function whether or not to verify that the address ends in a two-letter 
	country or well-known TLD.  1 means check it, 0 means don't. */
	var checkTLD=0;

	/* The following is the list of known TLDs that an e-mail address must end with. */
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

	/* The following pattern is used to check if the entered e-mail address fits the user@domain format. It also is used to
	 separate the username from the domain. */
	var emailPat=/^(.+)@(.+)$/;

	/* The following string represents the pattern for matching all special characters.  We don't want to allow special characters 
	in the address. These characters include ( ) < > @ , ; : \ " . [ ] */
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

	/* The following string represents the range of characters allowed in a username or domainname.  It really states which chars 
	aren't allowed.*/
	var validChars="\[^\\s" + specialChars + "\]";

	/* The following pattern applies if the "user" is a quoted string (in which case, there are no rules about which characters are 	allowed and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com is a legal e-mail address. */
	var quotedUser="(\"[^\"]*\")";

	/* The following pattern applies for domains that are IP addresses, rather than symbolic names.  E.g. joe@[123.124.233.4] is a 
	legal e-mail address. NOTE: The square brackets are required. */
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

	/* The following string represents an atom (basically a series of non-special characters.) */
	var atom=validChars + '+';

	/* The following string represents one word in the typical username. For example, in john.doe@somewhere.com, john and doe are 
	words. Basically, a word is either an atom or quoted string. */
	var word="(" + atom + "|" + quotedUser + ")";

	// The following pattern describes the structure of the user
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

	/* The following pattern describes the structure of a normal symbolic domain, as opposed to ipDomainPat, shown above. */
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

	/* Finally, let's start trying to figure out if the supplied address is valid. */
	/* Begin with the coarse pattern to simply break up user@domain into different pieces that are easy to analyze. */
	var matchArray=emailStr.match(emailPat);
	
	if (matchArray==null) 
		{
		/* Too many/few @'s or something; basically, this address doesn't even fit the general mould of a valid e-mail address. */
		alert("Email address seems incorrect (check @ and .'s)");
		return false;
		}

	var user=matchArray[1];
	var domain=matchArray[2];

	// Start by checking that only basic ASCII characters are in the strings (0-127).
	for (i=0; i<user.length; i++) 
		{
		if (user.charCodeAt(i)>127) 
			{
			alert("Ths email username contains invalid characters.");
			return false;
			}
		}
	for (i=0; i<domain.length; i++) 
		{
		if (domain.charCodeAt(i)>127) 
			{
			alert("Ths email domain name contains invalid characters.");
			return false;
			}
		}
	
	// See if "user" is valid 
	if (user.match(userPat)==null) 
		{
		// user is not valid
		alert("The email username doesn't seem to be valid.");
		return false;
		}

	/* if the e-mail address is at an IP address (as opposed to a symbolic host name) make sure the IP address is valid. */
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) 
		{
		// this is an IP address
		for (var i=1;i<=4;i++) 
			{
			if (IPArray[i]>255) 
				{
				alert("email Destination IP address is invalid!");
				return false;
				}
			}
		}
		
	// Domain is symbolic name.  Check if it's valid.
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++)
		{
		if (domArr[i].search(atomPat)==-1) 
			{
			alert("The email domain name does not seem to be valid.");
			return false;
			}
		}

	/* domain name seems valid, but now make sure that it ends in a known top-level domain (like com, edu, gov) or a two-letter
	 word, representing country (uk, nl), and that there's a hostname preceding the domain or country. */

	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) 
		{
		alert("The email address must end in a well-known domain or two letter " + "country.");
		return false;
		}

	// Make sure there's a host name preceding the domain.
	if (len<2) 
		{
		alert("This email address is missing a hostname!");
		return false;
		}

	// If we've gotten this far, everything's valid!
	return ("done");
	}
	
function isblank(s)
	{
    for(var i=0; i < s.length; i++)
    	{
        var c = s.charAt(i);
        if((c!=' ')&&(c!="\n")&&(c!="\t"))
        return false;
        }
	return true;
}


function username_focus()
	{
	document.dataform.username.focus();
	}

function set()
	{
	if(document.dataform.username.value=="")
		{
		alert("Enter User Name");
		document.dataform.username.focus();
		return false;
		}
	if(document.dataform.passwd.value=="")
		{
		alert("Enter your Password");
		document.dataform.passwd.focus();
		return false;
		}
	}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr);
}

function chkId()
	{
 	if ( isblank(document.loginform.username.value) )
 		{
    	alert("Enter Mirchi ID");
    	document.loginform.username.focus();
    	}
 	else
 		{
     	var username=document.loginform.username.value;
		window.location.replace('forgotPassword.php?username='+username);
 		}
	}

function username_focus()
	{
	document.loginform.username.focus();
	}

function set()
	{
	if(document.loginform.username.value=="")
		{
		alert("Enter User Name");
		document.loginform.username.focus();
		return false;
		}
	if(document.loginform.passwd.value=="")
		{
		alert("Enter your Password");
		document.loginform.passwd.focus();
		return false;
		}
	}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr);
}

function CheckForLogin(id)
{
       
	if(!(id!="0" && id!="")){	
		alert("Please login to use this feature");
		return false;
	}
       if(document.PostCommtform.CommentText.value=="Add a Comment" || document.PostCommtform.CommentText.value==""){
       
         alert("Please add a comment");
         document.PostCommtform.CommentText.value="";
         document.PostCommtform.CommentText.focus();
         return false;
       
       }	
	
}



function clearText()
{
    
   if(document.PostCommtform.CommentText.value=="Add a Comment"){
      
       document.PostCommtform.CommentText.value="";
       document.PostCommtform.CommentText.focus();
       return false;
   
   }

}

function ModeratePostAns(repid,senderId){

   
   if(document.getElementById("ans"+repid).value=="Post a Answer" || document.getElementById("ans"+repid).value==""){
    
    alert("Please add a answer");
    return false;
   }
   else{
   
      document.moderate_comm_form.postedans.value=document.getElementById("ans"+repid).value;
      document.moderate_comm_form.private.value=document.getElementById("prv"+repid).value;
      document.moderate_comm_form.scrapId.value=repid;
      document.moderate_comm_form.senderId.value=senderId;
     
      document.moderate_comm_form.pmode.value="PostAns";
      document.moderate_comm_form.submit();
   }
}


function ModerateComment(formname, mode, scrapid)
{
	formname.pmode.value=mode;
	formname.scrapId.value=scrapid;
	formname.submit();
}

function validActivationForm(formname)
{
	if(formname.username.value=="")
	{
		alert("Please enter username");
		formname.username.focus();
		return false;
	}
	else
	{
		var nonums = /^[0-9_]*$/;
		if (nonums.test(formname.username.value)) 
		{
			alert("Invalid username.");
			return false;
		}

		var iChars = " \n\t`~!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
		for (var i = 0; i < formname.username.value.length; i++) 
		{
			if (iChars.indexOf(formname.username.value.charAt(i)) != -1) 
			{
				alert ("Invalid username");
				return false;
			}
		}		
	}
	
	if(formname.email.value=="")
	{
		alert("Please enter email");
		formname.email.focus();
		return false;
	}
	else
	{
		if(emailCheck(formname.email.value)!="done")
		{
			formname.email.focus();
			return false;
		}
	}
}


function EmailCheckjs(argvalue)
{
	if (argvalue.indexOf(" ") != -1)
	  return false;
	else if (argvalue.indexOf("@") == -1)
	  return false;
	else if (argvalue.indexOf("@") == 0)
	  return false;
	else if (argvalue.indexOf("@") == (argvalue.length-1))
	  return false;
	var arrayString = argvalue.split("@");
	if(arrayString.length > 2)
	  return false;
	if (arrayString[1].indexOf(".") == -1)
	  return false;
	else if (arrayString[1].indexOf(".") == 0)
	  return false;
	else if (arrayString[1].charAt(arrayString[1].length-1) == ".") {
	  return false;
	}
  return true;
}


function Trim(TRIM_VALUE)
{
	if(TRIM_VALUE.length < 1)
	{
		return"";
	}
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	if(TRIM_VALUE=="")
	{
		return "";
	}
	else
	{
		return TRIM_VALUE;
	}
} //End Function

function RTrim(VALUE)
{
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0)
	{
		return"";
	}
	var iTemp = v_length -1;
	while(iTemp > -1)
	{
		if(VALUE.charAt(iTemp) == w_space)
		{
		}
		else
		{
			strTemp = VALUE.substring(0,iTemp +1);
			break;
		}
		iTemp = iTemp-1;
	} //End While
	return strTemp;
} //End Function

function LTrim(VALUE)
{
	var w_space = String.fromCharCode(32);
	if(v_length < 1)
	{
		return"";
	}
	var v_length = VALUE.length;
	var strTemp = "";
	var iTemp = 0;
	while(iTemp < v_length)
	{
		if(VALUE.charAt(iTemp) == w_space)
		{
		}
		else
		{
			strTemp = VALUE.substring(iTemp,v_length);
			break;
		}
		iTemp = iTemp + 1;
	} //End While
	return strTemp;
} //End Function

function textCounter(field,counter,maxlimit,linecounter) {
	// text width//
		var fieldWidth =  parseInt(field.offsetWidth);
		var charcnt = field.value.length;

		// trim the extra text
		if (charcnt > maxlimit) {
			field.value = field.value.substring(0, maxlimit);
		}

		else {
		// progress bar percentage
		var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;
		document.getElementById(counter).style.width =  parseInt((fieldWidth*percentage)/100)+"px";
		document.getElementById(counter).innerHTML=""+percentage+"%"
		// color correction on style from CCFFF -> CC0000
		setcolor(document.getElementById(counter),percentage,"background-color");
		}
}


function setcolor(obj,percentage,prop){
	obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";
}

//for CreateCommunity

function goBack()
{
 //alert("{$V_GO_TO}");
 window.location.replace('comunityList.php');
 document.dataform2.goback.value="y";
 document.dataform2.submit(); 
}


function set1()
{  
   	df=document.dataform2;
	
          //alert on finding all numbers
          var nonums = /^[0-9_]*$/;
          if (nonums.test(document.dataform2.name.value)) 
          {
               alert("Community Name Can Contain only alphabets and numbers and underscore");
               return false;
          }
        
          var iChars = " \n\t`~!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
          for (var i = 0; i < document.dataform2.name.value.length; i++) 
          {
             if (iChars.indexOf(document.dataform2.name.value.charAt(i)) != -1) 
             {
              alert ("Community Name Can Contain only alphabets and numbers and underscore ");
              return false;
             }
          }
          
  	

		 if(document.dataform2.name.value=="")
			{
				alert("Enter Community name")
				document.dataform2.name.focus();
				return false;
			}				
			else if ( document.dataform2.cmcategory.options[document.dataform2.cmcategory.selectedIndex].value == "" )
			{
			  alert("Select Category");
				 document.dataform2.cmcategory.focus();
			  return false;
			}
			
			
  			if( isblank(document.dataform2.description.value))
  			{
  				alert("Description can not be blank")
  				document.dataform2.description.focus();
  				return false;
  			}
			
			
		return true;
}	
function AddDestinations()
{
	var	FName = document.getElementById('friends');
	var data = "";
	
	var len = FName.length;
	
	for(i=0; i<len; i++)
	{
		if(FName.options[i].selected)
		{
			data = data+FName.options[i].value+",";
		}
	}
	//alert(data);
	
	document.getElementById("destination").value = data;	
	var destiny = document.getElementById("destination").value;

	var deslen = destiny.length-1;

	if(destiny.charAt(deslen)==",")
	{
		document.getElementById("destination").value = destiny.substring(0,deslen);
	}
}

function AddDestinations2()
{
	var	FName = document.getElementById('friends');
	var data = "";
	
	var len = FName.length;
	
	for(i=0; i<len; i++)
	{
		if(FName.options[i].selected)
		{
			data = data+FName.options[i].value+",";
		}
	}
	
	if(document.getElementById("destination").value.length > 0)
	{
		document.getElementById("destination").value += ",";	
	}
	document.getElementById("destination").value += data;	
	var destiny = document.getElementById("destination").value;

	var deslen = destiny.length-1;

	if(destiny.charAt(deslen)==",")
	{
		document.getElementById("destination").value = destiny.substring(0,deslen);
	}
}

//Comunity List

function member(grpname,gId)
{
		
		document.comunityList.action='listmembers.php';
		document.comunityList.groupnam.value=grpname;
		document.comunityList.groupid.value=gId;
		//obj.groupnam.value=grpname;
		document.comunityList.submit();
		
}

// Buddy List 2grp

function buddygrp_back(obj)
{
	obj.action='list_members.php';	
	obj.submit();
}

function ChangeInboxSelectOption()
{
	ctr = document.inbox;
	if(ctr.sel_option.value=="None")
	{
			for (i=0;i<ctr.length;i++)
			{
				var el = ctr.elements[i].name;
				if (el.indexOf("messid")!= -1)
				{
					ctr.elements[i].checked=false;
				}
			}
	}
	if(ctr.sel_option.value=="All")
	{
			for (i=0;i<ctr.length;i++)
			{
				var el = ctr.elements[i].name;
				if (el.indexOf("messid")!= -1)
				{
					ctr.elements[i].checked=true;
				}
			}
	}

	if(ctr.sel_option.value=="Read")
	{
			for (i=0;i<ctr.length;i++)
			{
				var el = ctr.elements[i].name;
				if (el.indexOf("messid")!= -1)
				{
					var toggId = ctr.elements[i].id;
					if (toggId.indexOf("_0")!= -1)
					{
						ctr.elements[i].checked=false;
					}
					else
					{
						ctr.elements[i].checked=true;
					}

				}
			}
	}

	if(ctr.sel_option.value=="Unread")
	{
			for (i=0;i<ctr.length;i++)
			{
				var el = ctr.elements[i].name;
				if (el.indexOf("messid")!= -1)
				{
					var toggId = ctr.elements[i].id;
					if (toggId.indexOf("_0")!= -1)
					{
						ctr.elements[i].checked=true;
					}
					else
					{
						ctr.elements[i].checked=false;
					}

				}
			}
	}

}

function  changeMarkAs(txt)
{
	ctr = document.inbox;
	ctr.mark_as.value=txt;
	ctr.submit();
}

//List Members
function dele(obj)
{
		
	document.dataform1.del.value=obj;
	
	document.dataform1.submit();
}

function ConfirmMessDel(id)
{
	var where_to = confirm("Do you want to delete this message?");
	if(where_to == true)
	{
		ctr = document.inbox;
		ctr.id_message.value = id;
		ctr.mode.value = "MessageDelete";
		ctr.action="process.php";
		ctr.submit();
	}
}

function ConfirmMessDelForCommunity(id)
{
	var where_to = confirm("Do you want to delete this message?");
	if(where_to == true)
	{
		ctr = document.inbox;
		ctr.id_message.value = id;
		ctr.mode.value = "MessageDeleteForCommunity";
		ctr.action="process.php";
		ctr.submit();
	}
}

//Comunity friend

function accept1(obj)
{
	
	obj.acc.value=obj.requestId.value;
	//alert(obj.acc.value);

	obj.submit();
}

function reject1(obj)
{
	obj.rej.value=obj.requestId.value;
	//alert(obj.rej.value);
	
	obj.submit();
	
	
}

function showInline (elName) {
    
	var theElemenet = document.getElementById(elName);
	if (theElemenet) {
		theElemenet.style.display = "inline";
	}
}
function hideInline (elName) {
	var theElemenet = document.getElementById(elName);
	if (theElemenet) {
		theElemenet.style.display = "none";
	}
}

function ValidateSendMessage()
{
	ctr = document.send_sms;
	if(ctr.phone.value=="")
	{
		alert("Please enter phone number.");
		ctr.phone.focus();
		return false;
	}

	if(isNaN(ctr.phone.value))
	{
		alert("Phone number should be numeric only.");
		ctr.phone.focus();
		return false;
	}
	if(ctr.phone.value.length<10)
	{
		alert("Invalid phone number.");
		ctr.phone.focus();
		return false;
	}
	return true;
}

function SetSoftboardHeight()
{
	if(document.getElementById("oDiv")!=undefined)
	{
		var theDiv = document.getElementById("oDiv");
		var dheight = theDiv.offsetHeight;	
		if(dheight==0)
		{
			theDiv.style.height=404;
		}
		else
		{
			if(dheight<404)
			{
				theDiv.style.height=parseInt(dheight+60);
			}
			else
			{
				theDiv.style.height=404;
			}
		}	
	}
}

function ValidateUploadCelebrityImage()
{
	ctr = document.send_sms;
	if(ctr.reference.value=="")
	{
		alert("Please select an image.");
		ctr.reference.focus();
		return false;
	}
	return true;
}



function ShowHideLeft(toggleId)
{
var body1 = document.getElementById(toggleId);
var body2 = document.getElementById("link_"+toggleId);
//alert("this is here..."+body2);
	
	if (body1.style.display == "none")
	{
		body1.style.display = "block";
		
		body2.className='left_category_sel';
				
	}
	else
	{
		body1.style.display = "none";
		body2.className='left_category';
		
		
	}
	
		var x;
		for (x in myCats)
		{
				
			if(toggleId == myCats[x]){
			var body1 = document.getElementById(myCats[x]);
				body1.style.display = "block";
				var body2 = document.getElementById("link_"+myCats[x]);
				body2.className='left_category_sel';
				
			} else {
				var body1 = document.getElementById(myCats[x]);
				body1.style.display = "none";
				var body2 = document.getElementById("link_"+myCats[x]);
				body2.className='left_category';
				
				
			}	
	  } 
	  
	        
}

function ShowLeft(toggleId,sel_img)
{
//alert("toggleId = " + toggleId);
	var body1 = document.getElementById(toggleId);
	body1.style.display = "block";
	
}

function open_timedMenu(menuName, openTime)
{
  //clearTimeout(menuTimer);
  ShowHideLeft(menuName);
  
  //var functionStr = "ShowHideLeft('" + menuName + "')";
  //menuTimer = setTimeout(functionStr, openTime);
}

function open_timedMenu_1(menuName, openTime, bgsel)
{
  //clearTimeout(menuTimer);
  //var functionStr = "ShowHideLeft('" + menuName + "')";
  //ShowHideLeft(menuName);
  var body1 = document.getElementById(menuName);
  body1.style.display = "none";
  
  var body2 = document.getElementById("link_"+menuName);
  if(bgsel =="yes")
  {
  body2.className='left_category_sel';
  }else
  {
  body2.className='left_category';
  }
  

	        
 
}
function open_timedMenu_3(menuName, openTime)
{
  var body2 = document.getElementById("link_"+menuName);
  body2.className='left_category_sel';
//alert("aaaaaaaaaaa");
//document.getElementById(menuName).className='leftbg_sel';
}
function open_timedMenu_4(menuName, openTime)
{
  var body2 = document.getElementById("link_"+menuName);
  body2.className='left_category';

//document.getElementById(leftcr).className='';
}

function mouseover(leftcr, openfly)
{
document.getElementById(leftcr).className='leftbg_sel';
 var body2 = document.getElementById("link_"+openfly);
  body2.className='left_category_sel';
  

//$newtst="onMouseover=dropdownmenu('leftcat1')";
}
function mouseout(leftcr, openfly, bgsel)
{
document.getElementById(leftcr).className='left_category';
 var body2 = document.getElementById("link_"+openfly);
 if(bgsel =="yes")
  {
 body2.className='left_category_sel';
 }else
 {
  body2.className='left_category';
 
 }
} 


function mouseout_1(toggleId,toggleclr)
{
	var body1 = document.getElementById(toggleId);
	body1.style.display = "none";
	document.getElementById(toggleclr).className='left_category';
	var body2 = document.getElementById("link_"+toggleId);
	body2.className='left_category';
} 

function mouseover_2(toggleId,toggleclr)
{
var body1 = document.getElementById(toggleId);
body1.style.display = "block";
document.getElementById(toggleclr).className='leftbg_sel';
var body2 = document.getElementById("link_"+toggleId);
body2.className='left_category_sel';
} 


function mouseover_topmenu(toggleId)
{
var body2 = document.getElementById("main_div_"+toggleId);
var link_text = document.getElementById("main_div_url_"+toggleId);
body2.className='leftbg_sel';
link_text.style.color="#ffffff";
//link_text.className='sublink_se';
} 

function mouseout_topmenu(toggleId,cat)
{
var body2 = document.getElementById("main_div_"+toggleId);
var link_text = document.getElementById("main_div_url_"+toggleId);
body2.className='';
if(toggleId == cat){
//link_text.className='sublink_sel';
link_text.style.color="#FF3746";
} else {
//link_text.className='sublink';
 link_text.style.color="#000000";
}
} 

function mouseover_topmenu_off(toggleId)
{
var body2 = document.getElementById("main_div_"+toggleId);
var link_text = document.getElementById("main_div_url_"+toggleId);
body2.className='sublink_se';
//link_text.style.color="#ffffff";
link_text.className='sublink_se';
} 

function mouseout_topmenu_off(toggleId,cat)
{
var body2 = document.getElementById("main_div_"+toggleId);
var link_text = document.getElementById("main_div_url_"+toggleId);
body2.className='';
if(toggleId == cat){
link_text.className='sublink_se';

} else {
link_text.className='sublink';

}
} 

function ShowLeftAsSelected(ctn_sel,ctn_td){
	if(ctn_td !="")
	{
	var body1 = document.getElementById(ctn_td);
	body1.className='leftbg_sel';	
	}
	if(ctn_sel != "")
	{
	var body2 = document.getElementById(ctn_sel);
	//body2.className='left_category_sel';	
	body2.className='text_kursiv_red';	
	}
}

function ShowTopAsSelected(ctn_sel){
	if(ctn_sel !="")
	{
	var body2 = document.getElementById(ctn_sel);
	body2.className='sublink_sel';	
	}
}

function ShowBottomAsSelected(ctn_sel){
	if(ctn_sel != "")
	{
	var body2 = document.getElementById(ctn_sel);
	body2.className='bslinkfooternew_red';		
	}	
}


// #########  code from images/wz_tooltip.js   ######### //

/* This notice must be untouched at all times.

wz_tooltip.js	 v. 4.12

The latest version is available at
http://www.walterzorn.com
or http://www.devira.com
or http://www.walterzorn.de

Copyright (c) 2002-2007 Walter Zorn. All rights reserved.
Created 1.12.2002 by Walter Zorn (Web: http://www.walterzorn.com )
Last modified: 13.7.2007

Easy-to-use cross-browser tooltips.
Just include the script at the beginning of the <body> section, and invoke
Tip('Tooltip text') from within the desired HTML onmouseover eventhandlers.
No container DIV, no onmouseouts required.
By default, width of tooltips is automatically adapted to content.
Is even capable of dynamically converting arbitrary HTML elements to tooltips
by calling TagToTip('ID_of_HTML_element_to_be_converted') instead of Tip(),
which means you can put important, search-engine-relevant stuff into tooltips.
Appearance of tooltips can be individually configured
via commands passed to Tip() or TagToTip().

Tab Width: 4
LICENSE: LGPL

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License (LGPL) as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

For more details on the GNU Lesser General Public License,
see http://www.gnu.org/copyleft/lesser.html
*/

var browserUsed = detectBrowser();

var config = new Object();


//===================  GLOBAL TOOPTIP CONFIGURATION  =========================//
var  tt_Debug	= true		// false or true - recommended: false once you release your page to the public
var  tt_Enabled	= true		// Allows to (temporarily) suppress tooltips, e.g. by providing the user with a button that sets this global variable to false
var  TagsToTip	= true		// false or true - if true, the script is capable of converting HTML elements to tooltips

// For each of the following config variables there exists a command, which is
// just the variablename in uppercase, to be passed to Tip() or TagToTip() to
// configure tooltips individually. Individual commands override global
// configuration. Order of commands is arbitrary.
// Example: onmouseover="Tip('Tooltip text', LEFT, true, BGCOLOR, '#FF9900', FADEIN, 400)"

config. Above			= false 	// false or true - tooltip above mousepointer?
config. BgColor 		= '#ffffff' // Background color
config. BgImg			= ''		// Path to background image, none if empty string ''
config. BorderColor 	= '#cccccc'
config. BorderStyle 	= 'solid'	// Any permitted CSS value, but I recommend 'solid', 'dotted' or 'dashed'
config. BorderWidth 	= 1
config. CenterMouse 	= false 	// false or true - center the tip horizontally below (or above) the mousepointer
config. ClickClose		= false// false or true - close tooltip if the user clicks somewhere
config. CloseBtn		= false 	// false or true - closebutton in titlebar
config. CloseBtnColors	= ['#990000', '#FF3746', '#DD3333', '#FFFFFF']	  // [Background, text, hovered background, hovered text] - use empty strings '' to inherit title colors
config. CloseBtnText	= '&nbsp;X&nbsp;'	// Close button text (may also be an image tag)
config. CopyContent		= true		// When converting a HTML element to a tooltip, copy only the element's content, rather than converting the element by its own
config. Delay			= 0		// Time span in ms until tooltip shows up
config. Duration		= 0 		// Time span in ms after which the tooltip disappears; 0 for infinite duration
config. FadeIn			= 0 		// Fade-in duration in ms, e.g. 400; 0 for no animation
config. FadeOut 		= 0
config. FadeInterval	= 30		// Duration of each fade step in ms (recommended: 30) - shorter is smoother but causes more CPU-load
config. Fix 			= null
config. FollowMouse		= false		// false or true - tooltip follows the mouse
config. FontColor		= '#000044'
config. FontFace		= 'Tahoma,Verdana,Geneva,sans-serif'
config. FontSize		= '8pt' 	// E.g. '9pt' or '12px' - unit is mandatory
config. FontWeight		= 'normal'	// 'normal' or 'bold';
config. Left			= false 	// false or true - tooltip on the left of the mouse
config. OffsetX 		= -400		// Horizontal offset of left-top corner from mousepointer
config. OffsetY 		= -100 		// Vertical offset
config. Opacity 		= 100		// Integer between 0 and 100 - opacity of tooltip in percent
config. Padding 		= 0 		// Spacing between border and content
config. Shadow			= false 	// false or true
config. ShadowColor 	= '#C0C0C0'
config. ShadowWidth 	= 2
config. Sticky			= true 	// Do NOT hide tooltip on mouseout? false or true
config. TextAlign		= 'left'	// 'left', 'right' or 'justify'
config. Title			= ''		// Default title text applied to all tips (no default title: empty string '')
config. TitleAlign		= 'left'	// 'left' or 'right' - text alignment inside the title bar
config. TitleBgColor	= ''		// If empty string '', BorderColor will be used
config. TitleFontColor	= '#ffffff'	// Color of title text - if '', BgColor (of tooltip body) will be used
config. TitleFontFace	= ''		// If '' use FontFace (boldified)
config. TitleFontSize	= ''		// If '' use FontSize
config. Width			= 0 		// Tooltip width; 0 for automatic adaption to tooltip content
//=======  END OF TOOLTIP CONFIG, DO NOT CHANGE ANYTHING BELOW  ==============//




//======================  PUBLIC  ============================================//
function Tip()
{
	tt_Tip(arguments, null);
}
function TagToTip()
{
	if(TagsToTip)
	{
		var t2t = tt_GetElt(arguments[0]);
		if(t2t)
			tt_Tip(arguments, t2t);
	}
}

//==================  PUBLIC EXTENSION API	==================================//
// Extension eventhandlers currently supported:
// OnLoadConfig, OnCreateContentString, OnSubDivsCreated, OnShow, OnMoveBefore,
// OnMoveAfter, OnHideInit, OnHide, OnKill

var tt_aElt = new Array(10), // Container DIV, outer title & body DIVs, inner title & body TDs, closebutton SPAN, shadow DIVs, and IFRAME to cover windowed elements in IE
tt_aV = new Array(),	// Caches and enumerates config data for currently active tooltip
tt_sContent,			// Inner tooltip text or HTML
tt_scrlX = 0, tt_scrlY = 0,
tt_musX, tt_musY,
tt_over,
tt_x, tt_y, tt_w, tt_h; // Position, width and height of currently displayed tooltip


var IsSafari = null;

function tx_isSafari()
{
    if (IsSafari == null) {
        IsSafari = navigator.userAgent.indexOf("Safari") >= 0;
    }
    return IsSafari;
}

function tx_getDocumentElement()
{
    return tx_isSafari() ? document.body : document.documentElement;
}

function tx_windowScrollTop()
{
    var documentElement = tx_getDocumentElement();
    return documentElement.scrollTop;
}

function getWindowTopEdge()
{
    var topEdge = tx_windowScrollTop();
    return topEdge;
}

function tt_Extension()
{
	tt_ExtCmdEnum();
	tt_aExt[tt_aExt.length] = this;
	return this;
}
function tt_SetTipPos(x, y)
{
	var css = tt_aElt[0].style;

	tt_x = x;
	tt_y = y;
	css.left = x + "px";
	//css.top = y + "px";
	//alert(getWindowTopEdge());
	if(getWindowTopEdge()<260)
	{
		css.top = y + "px";
	}	
	else
	{
		css.top = (getWindowTopEdge()+20) + "px";
	}
	
	if(tt_ie56)
	{
		var ifrm = tt_aElt[tt_aElt.length - 1];
		if(ifrm)
		{
			ifrm.style.left = css.left;
			ifrm.style.top = css.top;
		}
	}
}
function tt_Hide()
{
	
	if(tt_db && tt_iState)
	{
		//document.getElementById("popupmaskloadingTip").className="popupMaskForLoading2";	
		
		if(tt_iState & 0x2)
		{
			tt_aElt[0].style.visibility = "hidden";
			tt_ExtCallFncs(0, "Hide");
		}
		tt_tShow.EndTimer();
		tt_tHide.EndTimer();
		tt_tDurt.EndTimer();
		tt_tFade.EndTimer();
		if(!tt_op && !tt_ie)
		{
			tt_tWaitMov.EndTimer();
			tt_bWait = false;
		}
		if(tt_aV[CLICKCLOSE])
			tt_RemEvtFnc(document, "mouseup", tt_HideInit);
		tt_AddRemOutFnc(false);
		tt_ExtCallFncs(0, "Kill");
		// In case of a TagToTip tooltip, hide converted DOM node and
		// re-insert it into document
		if(tt_t2t && !tt_aV[COPYCONTENT])
		{
			tt_t2t.style.display = "none";
			tt_MovDomNode(tt_t2t, tt_aElt[6], tt_t2tDad);
		}
		tt_iState = 0;
		tt_over = null;
		tt_ResetMainDiv();
		if(tt_aElt[tt_aElt.length - 1])
			tt_aElt[tt_aElt.length - 1].style.display = "none";
		
		
	}
}
function tt_GetElt(id)
{
	return(document.getElementById ? document.getElementById(id)
			: document.all ? document.all[id]
			: null);
}
function tt_GetDivW(el)
{
	return(el ? (el.offsetWidth || el.style.pixelWidth || 0) : 0);
}
function tt_GetDivH(el)
{
	return(el ? (el.offsetHeight || el.style.pixelHeight || 0) : 0);
}
function tt_GetScrollX()
{
	return(window.pageXOffset || (tt_db ? (tt_db.scrollLeft || 0) : 0));
}
function tt_GetScrollY()
{
	return(window.pageYOffset || (tt_db ? (tt_db.scrollTop || 0) : 0));
}
function tt_GetClientW()
{
	return(document.body && (typeof(document.body.clientWidth) != tt_u) ? document.body.clientWidth
			: (typeof(window.innerWidth) != tt_u) ? window.innerWidth
			: tt_db ? (tt_db.clientWidth || 0)
			: 0);
}
function tt_GetClientH()
{
	// Exactly this order seems to yield correct values in all major browsers
	return(document.body && (typeof(document.body.clientHeight) != tt_u) ? document.body.clientHeight
			: (typeof(window.innerHeight) != tt_u) ? window.innerHeight
			: tt_db ? (tt_db.clientHeight || 0)
			: 0);
}
function tt_GetEvtX(e)
{
	return (e ? ((typeof(e.pageX) != tt_u) ? e.pageX : (e.clientX + tt_scrlX)) : 0);
}
function tt_GetEvtY(e)
{
	return (e ? ((typeof(e.pageY) != tt_u) ? e.pageY : (e.clientY + tt_scrlY)) : 0);
}
function tt_AddEvtFnc(el, sEvt, PFnc)
{
	if(el)
	{
		if(el.addEventListener)
			el.addEventListener(sEvt, PFnc, false);
		else
			el.attachEvent("on" + sEvt, PFnc);
	}
}
function tt_RemEvtFnc(el, sEvt, PFnc)
{
	if(el)
	{
		if(el.removeEventListener)
			el.removeEventListener(sEvt, PFnc, false);
		else
			el.detachEvent("on" + sEvt, PFnc);
	}
}

//======================  PRIVATE  ===========================================//
var tt_aExt = new Array(),	// Array of extension objects

tt_db, tt_op, tt_ie, tt_ie56, tt_bBoxOld,	// Browser flags
tt_body,
tt_flagOpa, 			// Opacity support: 1=IE, 2=Khtml, 3=KHTML, 4=Moz, 5=W3C
tt_maxPosX, tt_maxPosY,
tt_iState = 0,			// Tooltip active |= 1, shown |= 2, move with mouse |= 4
tt_opa, 				// Currently applied opacity
tt_bJmpVert,			// Tip above mouse (or ABOVE tip below mouse)
tt_t2t, tt_t2tDad,		// Tag converted to tip, and its parent element in the document
tt_elDeHref,			// The tag from which Opera has removed the href attribute
// Timer
tt_tShow = new Number(0), tt_tHide = new Number(0), tt_tDurt = new Number(0),
tt_tFade = new Number(0), tt_tWaitMov = new Number(0),
tt_bWait = false,
tt_u = "undefined";


function tt_Init()
{
	tt_MkCmdEnum();
	// Send old browsers instantly to hell
	if(!tt_Browser() || !tt_MkMainDiv())
		return;
	tt_IsW3cBox();
	tt_OpaSupport();
	tt_AddEvtFnc(document, "mousemove", tt_Move);
	// In Debug mode we search for TagToTip() calls in order to notify
	// the user if they've forgotten to set the TagsToTip config flag
	if(TagsToTip || tt_Debug)
		tt_SetOnloadFnc();
	tt_AddEvtFnc(window, "scroll",
		function()
		{
			tt_scrlX = tt_GetScrollX();
			tt_scrlY = tt_GetScrollY();
			if(tt_iState && !(tt_aV[STICKY] && (tt_iState & 2)))
				tt_HideInit();
		} );
	// Ensure the tip be hidden when the page unloads
	tt_AddEvtFnc(window, "unload", tt_Hide);
	tt_Hide();
}
// Creates command names by translating config variable names to upper case
function tt_MkCmdEnum()
{
	var n = 0;
	for(var i in config)
		eval("window." + i.toString().toUpperCase() + " = " + n++);
	tt_aV.length = n;
}
function tt_Browser()
{
	var n, nv, n6, w3c;

	n = navigator.userAgent.toLowerCase(),
	nv = navigator.appVersion;
	tt_op = (document.defaultView && typeof(eval("w" + "indow" + "." + "o" + "p" + "er" + "a")) != tt_u);
	tt_ie = n.indexOf("msie") != -1 && document.all && !tt_op;
	if(tt_ie)
	{
		var ieOld = (!document.compatMode || document.compatMode == "BackCompat");
		tt_db = !ieOld ? document.documentElement : (document.body || null);
		if(tt_db)
			tt_ie56 = parseFloat(nv.substring(nv.indexOf("MSIE") + 5)) >= 5.5
					&& typeof document.body.style.maxHeight == tt_u;
	}
	else
	{
		tt_db = document.documentElement || document.body ||
				(document.getElementsByTagName ? document.getElementsByTagName("body")[0]
				: null);
		if(!tt_op)
		{
			n6 = document.defaultView && typeof document.defaultView.getComputedStyle != tt_u;
			w3c = !n6 && document.getElementById;
		}
	}
	tt_body = (document.getElementsByTagName ? document.getElementsByTagName("body")[0]
				: (document.body || null));
	if(tt_ie || n6 || tt_op || w3c)
	{
		if(tt_body && tt_db)
		{
			if(document.attachEvent || document.addEventListener)
				return true;
		}
		else
			tt_Err("wz_tooltip.js must be included INSIDE the body section,"
					+ " immediately after the opening <body> tag.");
	}
	tt_db = null;
	return false;
}
function tt_MkMainDiv()
{
	// Create the tooltip DIV
	if(tt_body.insertAdjacentHTML)
		tt_body.insertAdjacentHTML("afterBegin", tt_MkMainDivHtm());
	else if(typeof tt_body.innerHTML != tt_u && document.createElement && tt_body.appendChild)
		tt_body.appendChild(tt_MkMainDivDom());
	// FireFox Alzheimer bug
	if(window.tt_GetMainDivRefs && tt_GetMainDivRefs())
		return true;
	tt_db = null;
	return false;
}
function tt_MkMainDivHtm()
{
	return('<div id="WzTtDiV"></div>' +
			(tt_ie56 ? ('<iframe id="WzTtIfRm" src="javascript:false" scrolling="no" frameborder="0" style="filter:Alpha(opacity=0);position:absolute;top:0px;left:0px;display:none;"></iframe>')
			: ''));
}
function tt_MkMainDivDom()
{
	var el = document.createElement("div");
	if(el)
		el.id = "WzTtDiV";
	return el;
}
function tt_GetMainDivRefs()
{
	tt_aElt[0] = tt_GetElt("WzTtDiV");
	if(tt_ie56 && tt_aElt[0])
	{
		tt_aElt[tt_aElt.length - 1] = tt_GetElt("WzTtIfRm");
		if(!tt_aElt[tt_aElt.length - 1])
			tt_aElt[0] = null;
	}
	if(tt_aElt[0])
	{
		var css = tt_aElt[0].style;

		css.visibility = "hidden";
		css.position = "absolute";
		css.overflow = "hidden";
		return true;
	}
	return false;
}
function tt_ResetMainDiv()
{
	var w = (window.screen && screen.width) ? screen.width : 10000;

	tt_SetTipPos(-w, 0);
	tt_aElt[0].innerHTML = "";
	tt_aElt[0].style.width = (w - 1) + "px";
}
function tt_IsW3cBox()
{
	var css = tt_aElt[0].style;

	css.padding = "10px";
	css.width = "40px";
	tt_bBoxOld = (tt_GetDivW(tt_aElt[0]) == 40);
	css.padding = "0px";
	tt_ResetMainDiv();
}
function tt_OpaSupport()
{
	var css = tt_body.style;

	tt_flagOpa = (typeof(css.filter) != tt_u) ? 1
				: (typeof(css.KhtmlOpacity) != tt_u) ? 2
				: (typeof(css.KHTMLOpacity) != tt_u) ? 3
				: (typeof(css.MozOpacity) != tt_u) ? 4
				: (typeof(css.opacity) != tt_u) ? 5
				: 0;
}
// Ported from http://dean.edwards.name/weblog/2006/06/again/
// (Dean Edwards et al.)
function tt_SetOnloadFnc()
{
	tt_AddEvtFnc(document, "DOMContentLoaded", tt_HideSrcTags);
	tt_AddEvtFnc(window, "load", tt_HideSrcTags);
	if(tt_body.attachEvent)
		tt_body.attachEvent("onreadystatechange",
			function() {
				if(tt_body.readyState == "complete")
					tt_HideSrcTags();
			} );
	if(/WebKit|KHTML/i.test(navigator.userAgent))
	{
		var t = setInterval(function() {
					if(/loaded|complete/.test(document.readyState))
					{
						clearInterval(t);
						tt_HideSrcTags();
					}
				}, 10);
	}
}
function tt_HideSrcTags()
{
	if(!window.tt_HideSrcTags || window.tt_HideSrcTags.done)
		return;
	window.tt_HideSrcTags.done = true;
	if(!tt_HideSrcTagsRecurs(tt_body))
		tt_Err("To enable the capability to convert HTML elements to tooltips,"
				+ " you must set TagsToTip in the global tooltip configuration"
				+ " to true.");
}
function tt_HideSrcTagsRecurs(dad)
{
	var a, ovr, asT2t;

	// Walk the DOM tree for tags that have an onmouseover attribute
	// containing a TagToTip('...') call.
	// (.childNodes first since .children is bugous in Safari)
	a = dad.childNodes || dad.children || null;
	for(var i = a ? a.length : 0; i;)
	{--i;
		if(!tt_HideSrcTagsRecurs(a[i]))
			return false;
		ovr = a[i].getAttribute ? a[i].getAttribute("onmouseover")
				: (typeof a[i].onmouseover == "function") ? a[i].onmouseover
				: null;
		if(ovr)
		{
			asT2t = ovr.toString().match(/TagToTip\s*\(\s*'[^'.]+'\s*[\),]/);
			if(asT2t && asT2t.length)
			{
				if(!tt_HideSrcTag(asT2t[0]))
					return false;
			}
		}
	}
	return true;
}
function tt_HideSrcTag(sT2t)
{
	var id, el;

	// The ID passed to the found TagToTip() call identifies an HTML element
	// to be converted to a tooltip, so hide that element
	id = sT2t.replace(/.+'([^'.]+)'.+/, "$1");
	el = tt_GetElt(id);
	if(el)
	{
		if(tt_Debug && !TagsToTip)
			return false;
		else
			el.style.display = "none";
	}
	else
		tt_Err("Invalid ID\n'" + id + "'\npassed to TagToTip()."
				+ " There exists no HTML element with that ID.");
	return true;
}
function tt_Tip(arg, t2t)
{
	if(!tt_db)
		return;
	if(tt_iState)
		tt_Hide();
	if(!tt_Enabled)
		return;
	tt_t2t = t2t;
	if(!tt_ReadCmds(arg))
		return;
	tt_iState = 0x1 | 0x4;
	tt_AdaptConfig1();
	tt_MkTipContent(arg);
	tt_MkTipSubDivs();
	tt_FormatTip();
	tt_bJmpVert = false;
	tt_maxPosX = tt_GetClientW() + tt_scrlX - tt_w - 1;
	tt_maxPosY = tt_GetClientH() + tt_scrlY - tt_h - 1;
	tt_AdaptConfig2();
	// We must fake the first mousemove in order to ensure the tip
	// be immediately shown and positioned
	tt_Move();
	tt_ShowInit();
	
	
}
function tt_ReadCmds(a)
{
	var i;

	// First load the global config values, to initialize also values
	// for which no command has been passed
	i = 0;
	for(var j in config)
		tt_aV[i++] = config[j];
	// Then replace each cached config value for which a command has been
	// passed (ensure the # of command args plus value args be even)
	if(a.length & 1)
	{
		for(i = a.length - 1; i > 0; i -= 2)
			tt_aV[a[i - 1]] = a[i];
		return true;
	}
	tt_Err("Incorrect call of Tip() or TagToTip().\n"
			+ "Each command must be followed by a value.");
	return false;
}
function tt_AdaptConfig1()
{
	tt_ExtCallFncs(0, "LoadConfig");
	// Inherit unspecified title formattings from body
	if(!tt_aV[TITLEBGCOLOR].length)
		tt_aV[TITLEBGCOLOR] = tt_aV[BORDERCOLOR];
	if(!tt_aV[TITLEFONTCOLOR].length)
		tt_aV[TITLEFONTCOLOR] = tt_aV[BGCOLOR];
	if(!tt_aV[TITLEFONTFACE].length)
		tt_aV[TITLEFONTFACE] = tt_aV[FONTFACE];
	if(!tt_aV[TITLEFONTSIZE].length)
		tt_aV[TITLEFONTSIZE] = tt_aV[FONTSIZE];
	if(tt_aV[CLOSEBTN])
	{
		// Use title colors for non-specified closebutton colors
		if(!tt_aV[CLOSEBTNCOLORS])
			tt_aV[CLOSEBTNCOLORS] = new Array("", "", "", "");
		for(var i = 4; i;)
		{--i;
			if(!tt_aV[CLOSEBTNCOLORS][i].length)
				tt_aV[CLOSEBTNCOLORS][i] = (i & 1) ? tt_aV[TITLEFONTCOLOR] : tt_aV[TITLEBGCOLOR];
		}
		// Enforce titlebar be shown
		if(!tt_aV[TITLE].length)
			tt_aV[TITLE] = " ";
	}
	// Circumvents broken display of images and fade-in flicker in Geckos < 1.8
	if(tt_aV[OPACITY] == 100 && typeof tt_aElt[0].style.MozOpacity != tt_u && !Array.every)
		tt_aV[OPACITY] = 99;
	// Smartly shorten the delay for fade-in tooltips
	if(tt_aV[FADEIN] && tt_flagOpa && tt_aV[DELAY] > 100)
		tt_aV[DELAY] = Math.max(tt_aV[DELAY] - tt_aV[FADEIN], 100);
}
function tt_AdaptConfig2()
{
	if(tt_aV[CENTERMOUSE])
		tt_aV[OFFSETX] -= ((tt_w - (tt_aV[SHADOW] ? tt_aV[SHADOWWIDTH] : 0)) >> 1);
}
// Expose content globally so extensions can modify it
function tt_MkTipContent(a)
{
	if(tt_t2t)
	{
		if(tt_aV[COPYCONTENT])
			tt_sContent = tt_t2t.innerHTML;
		else
			tt_sContent = "";
	}
	else
		tt_sContent = a[0];
	tt_ExtCallFncs(0, "CreateContentString");
}
function tt_MkTipSubDivs()
{
	var sCss = 'position:relative;margin:0px;padding:0px;border-width:0px;left:0px;top:0px;line-height:normal;width:auto;',
	sTbTrTd = ' cellspacing=0 cellpadding=0 border=0 style="' + sCss + '"><tbody style="' + sCss + '"><tr><td ';

	tt_aElt[0].innerHTML =
		(''
		+ (tt_aV[TITLE].length ?
			('<div id="WzTiTl" style="position:relative;z-index:1;">'
			+ '<table id="WzTiTlTb"' + sTbTrTd + 'id="WzTiTlI" style="' + sCss + '">'
			+ tt_aV[TITLE]
			+ '</td>'
			+ (tt_aV[CLOSEBTN] ?
				('<td align="right" style="' + sCss
				+ 'text-align:right;">'
				+ '<span id="WzClOsE" style="padding-left:2px;padding-right:2px;'
				+ 'cursor:' + (tt_ie ? 'hand' : 'pointer')
				+ ';" onmouseover="tt_OnCloseBtnOver(1)" onmouseout="tt_OnCloseBtnOver(0)" onclick="tt_HideInit()">'
				+ tt_aV[CLOSEBTNTEXT]
				+ '</span></td>')
				: '')
			+ '</tr></tbody></table></div>')
			: '')
		+ '<div id="WzBoDy" style="position:relative;z-index:0;">'
		+ '<table' + sTbTrTd + 'id="WzBoDyI" style="' + sCss + '">'
		+ tt_sContent
		+ '</td></tr></tbody></table></div>'
		+ (tt_aV[SHADOW]
			? ('<div id="WzTtShDwR" style="position:absolute;overflow:hidden;"></div>'
				+ '<div id="WzTtShDwB" style="position:relative;overflow:hidden;"></div>')
			: '')
		);
	tt_GetSubDivRefs();
	// Convert DOM node to tip
	if(tt_t2t && !tt_aV[COPYCONTENT])
	{
		// Store the tag's parent element so we can restore that DOM branch
		// once the tooltip is hidden
		tt_t2tDad = tt_t2t.parentNode || tt_t2t.parentElement || tt_t2t.offsetParent || null;
		if(tt_t2tDad)
		{
			tt_MovDomNode(tt_t2t, tt_t2tDad, tt_aElt[6]);
			tt_t2t.style.display = "block";
		}
	}
	tt_ExtCallFncs(0, "SubDivsCreated");
}
function tt_GetSubDivRefs()
{
	var aId = new Array("WzTiTl", "WzTiTlTb", "WzTiTlI", "WzClOsE", "WzBoDy", "WzBoDyI", "WzTtShDwB", "WzTtShDwR");

	for(var i = aId.length; i; --i)
		tt_aElt[i] = tt_GetElt(aId[i - 1]);
}
function tt_FormatTip()
{
	var css, w, iOffY, iOffSh;

	//--------- Title DIV ----------
	if(tt_aV[TITLE].length)
	{
		css = tt_aElt[1].style;
		css.background = tt_aV[TITLEBGCOLOR];
		css.paddingTop = (tt_aV[CLOSEBTN] ? 2 : 0) + "px";
		css.paddingBottom = "1px";
		css.paddingLeft = css.paddingRight = tt_aV[PADDING] + "px";
		css = tt_aElt[3].style;
		css.color = tt_aV[TITLEFONTCOLOR];
		css.fontFamily = tt_aV[TITLEFONTFACE];
		css.fontSize = tt_aV[TITLEFONTSIZE];
		css.fontWeight = "bold";
		css.textAlign = tt_aV[TITLEALIGN];
		// Close button DIV
		if(tt_aElt[4])
		{
			css.paddingRight = (tt_aV[PADDING] << 1) + "px";
			css = tt_aElt[4].style;
			css.background = tt_aV[CLOSEBTNCOLORS][0];
			css.color = tt_aV[CLOSEBTNCOLORS][1];
			css.fontFamily = tt_aV[TITLEFONTFACE];
			css.fontSize = tt_aV[TITLEFONTSIZE];
			css.fontWeight = "bold";
		}
		if(tt_aV[WIDTH] > 0)
			tt_w = tt_aV[WIDTH] + ((tt_aV[PADDING] + tt_aV[BORDERWIDTH]) << 1);
		else
		{
			tt_w = tt_GetDivW(tt_aElt[3]) + tt_GetDivW(tt_aElt[4]);
			// Some spacing between title DIV and closebutton
			if(tt_aElt[4])
				tt_w += tt_aV[PADDING];
		}
		// Ensure the top border of the body DIV be covered by the title DIV
		iOffY = -tt_aV[BORDERWIDTH];
	}
	else
	{
		tt_w = 0;
		iOffY = 0;
	}

	//-------- Body DIV ------------
	css = tt_aElt[5].style;
	css.top = iOffY + "px";
	if(tt_aV[BORDERWIDTH])
	{
		css.borderColor = tt_aV[BORDERCOLOR];
		css.borderStyle = tt_aV[BORDERSTYLE];
		css.borderWidth = tt_aV[BORDERWIDTH] + "px";
	}
	if(tt_aV[BGCOLOR].length)
		css.background = tt_aV[BGCOLOR];
	if(tt_aV[BGIMG].length)
		css.backgroundImage = "url(" + tt_aV[BGIMG] + ")";
	css.padding = tt_aV[PADDING] + "px";
	css.textAlign = tt_aV[TEXTALIGN];
	// TD inside body DIV
	css = tt_aElt[6].style;
	css.color = tt_aV[FONTCOLOR];
	css.fontFamily = tt_aV[FONTFACE];
	css.fontSize = tt_aV[FONTSIZE];
	css.fontWeight = tt_aV[FONTWEIGHT];
	css.background = "";
	css.textAlign = tt_aV[TEXTALIGN];
	if(tt_aV[WIDTH] > 0)
		w = tt_aV[WIDTH] + ((tt_aV[PADDING] + tt_aV[BORDERWIDTH]) << 1);
	else
		// We measure the width of the body's inner TD, because some browsers
		// expand the width of the container and outer body DIV to 100%
		w = tt_GetDivW(tt_aElt[6]) + ((tt_aV[PADDING] + tt_aV[BORDERWIDTH]) << 1);
	if(w > tt_w)
		tt_w = w;

	//--------- Shadow DIVs ------------
	if(tt_aV[SHADOW])
	{
		tt_w += tt_aV[SHADOWWIDTH];
		iOffSh = Math.floor((tt_aV[SHADOWWIDTH] * 4) / 3);
		// Bottom shadow
		css = tt_aElt[7].style;
		css.top = iOffY + "px";
		css.left = iOffSh + "px";
		css.width = (tt_w - iOffSh - tt_aV[SHADOWWIDTH]) + "px";
		css.height = tt_aV[SHADOWWIDTH] + "px";
		css.background = tt_aV[SHADOWCOLOR];
		// Right shadow
		css = tt_aElt[8].style;
		css.top = iOffSh + "px";
		css.left = (tt_w - tt_aV[SHADOWWIDTH]) + "px";
		css.width = tt_aV[SHADOWWIDTH] + "px";
		css.background = tt_aV[SHADOWCOLOR];
	}
	else
		iOffSh = 0;

	//-------- Container DIV -------
	tt_SetTipOpa(tt_aV[FADEIN] ? 0 : tt_aV[OPACITY]);
	tt_FixSize(iOffY, iOffSh);
}
// Fixate the size so it can't dynamically change while the tooltip is moving.
function tt_FixSize(iOffY, iOffSh)
{
	var wIn, wOut, i;

	tt_aElt[0].style.width = tt_w + "px";
	tt_aElt[0].style.pixelWidth = tt_w;
	wOut = tt_w - ((tt_aV[SHADOW]) ? tt_aV[SHADOWWIDTH] : 0);
	// Body
	wIn = wOut;
	if(!tt_bBoxOld)
		wIn -= ((tt_aV[PADDING] + tt_aV[BORDERWIDTH]) << 1);
	tt_aElt[5].style.width = wIn + "px";
	// Title
	if(tt_aElt[1])
	{
		wIn = wOut - (tt_aV[PADDING] << 1);
		if(!tt_bBoxOld)
			wOut = wIn;
		tt_aElt[1].style.width = wOut + "px";
		tt_aElt[2].style.width = wIn + "px";
	}
	tt_h = tt_GetDivH(tt_aElt[0]) + iOffY;
	// Right shadow
	if(tt_aElt[8])
		tt_aElt[8].style.height = (tt_h - iOffSh) + "px";
	i = tt_aElt.length - 1;
	if(tt_aElt[i])
	{
		tt_aElt[i].style.width = tt_w + "px";
		tt_aElt[i].style.height = tt_h + "px";
	}
}
function tt_DeAlt(el)
{
	var aKid;

	if(el.alt)
		el.alt = "";
	if(el.title)
		el.title = "";
	aKid = el.childNodes || el.children || null;
	if(aKid)
	{
		for(var i = aKid.length; i;)
			tt_DeAlt(aKid[--i]);
	}
}
// This hack removes the annoying native tooltips over links in Opera
function tt_OpDeHref(el)
{
	if(!tt_op)
		return;
	if(tt_elDeHref)
		tt_OpReHref();
	while(el)
	{
		if(el.hasAttribute("href"))
		{
			el.t_href = el.getAttribute("href");
			el.t_stats = window.status;
			el.removeAttribute("href");
			el.style.cursor = "hand";
			tt_AddEvtFnc(el, "mousedown", tt_OpReHref);
			window.status = el.t_href;
			tt_elDeHref = el;
			break;
		}
		el = el.parentElement;
	}
}
function tt_ShowInit()
{
	tt_tShow.Timer("tt_Show()", tt_aV[DELAY], true);
	if(tt_aV[CLICKCLOSE])
		tt_AddEvtFnc(document, "mouseup", tt_HideInit);
}
function tt_OverInit(e)
{
	tt_over = e.target || e.srcElement;
	tt_DeAlt(tt_over);
	tt_OpDeHref(tt_over);
	tt_AddRemOutFnc(true);
}
function tt_Show()
{
	var css = tt_aElt[0].style;

	// Override the z-index of the topmost wz_dragdrop.js D&D item
	css.zIndex = Math.max((window.dd && dd.z) ? (dd.z + 2) : 0, 1010);
	if(tt_aV[STICKY] || !tt_aV[FOLLOWMOUSE])
		tt_iState &= ~0x4;
	if(tt_aV[DURATION] > 0)
		tt_tDurt.Timer("tt_HideInit()", tt_aV[DURATION], true);
	tt_ExtCallFncs(0, "Show")
	css.visibility = "visible";
	tt_iState |= 0x2;
	if(tt_aV[FADEIN])
		tt_Fade(0, 0, tt_aV[OPACITY], Math.round(tt_aV[FADEIN] / tt_aV[FADEINTERVAL]));
	tt_ShowIfrm();
	
	//document.getElementById("popupmaskloadingTip").className="popupMaskForLoadingTip";
}
function tt_ShowIfrm()
{
	if(tt_ie56)
	{
		var ifrm = tt_aElt[tt_aElt.length - 1];
		if(ifrm)
		{
			var css = ifrm.style;
			css.zIndex = tt_aElt[0].style.zIndex - 1;
			css.display = "block";
		}
	}
}
function tt_Move(e)
{
	e = window.event || e;
	if(e)
	{
		tt_musX = tt_GetEvtX(e);
		tt_musY = tt_GetEvtY(e);
	}
	if(tt_iState)
	{
		if(!tt_over && e)
			tt_OverInit(e);
		if(tt_iState & 0x4)
		{
			// Protect some browsers against jam of mousemove events
			if(!tt_op && !tt_ie)
			{
				if(tt_bWait)
					return;
				tt_bWait = true;
				tt_tWaitMov.Timer("tt_bWait = false;", 1, true);
			}
			if(tt_aV[FIX])
			{
				tt_iState &= ~0x4;
				//commented for issue  P-2009-1218 FASHION.DE: New Productviews, and added new function below this line
				//tt_SetTipPos(tt_aV[FIX][0], tt_aV[FIX][1]);
				tt_PosFix();
			}
			else if(!tt_ExtCallFncs(e, "MoveBefore"))
				tt_SetTipPos(tt_PosX(), tt_PosY());
			tt_ExtCallFncs([tt_musX, tt_musY], "MoveAfter")
		}
	}
}


function tt_PosFix()
{
	var iX, iY;

	if(typeof(tt_aV[FIX][0]) == "number")
	{
		iX = tt_aV[FIX][0];
		iY = tt_aV[FIX][1];
	}
	else
	{
		if(typeof(tt_aV[FIX][0]) == "string")
			el = tt_GetElt(tt_aV[FIX][0]);
		// First slot in array is direct reference to HTML element
		else
			el = tt_aV[FIX][0];
		iX = tt_aV[FIX][1];
		iY = tt_aV[FIX][2];
		// By default, vert pos is related to bottom edge of HTML element
		if(!tt_aV[ABOVE] && el)
			iY += tt_GetDivH(el);
		for(; el; el = el.offsetParent)
		{
			iX += el.offsetLeft || 0;
			iY += el.offsetTop || 0;
		}
	}
	// For a fixed tip positioned above the mouse, use the bottom edge as anchor
	// (recommended by Christophe Rebeschini, 31.1.2008)
	if(tt_aV[ABOVE])
		iY -= tt_h;
	//tt_SetTipPos(iX, iY);
	tt_SetTipPos(296, iY);	
}

function tt_PosX()
{
	var x;

	x = tt_musX;
	if(tt_aV[LEFT])
		x -= tt_w + tt_aV[OFFSETX] - (tt_aV[SHADOW] ? tt_aV[SHADOWWIDTH] : 0);
	else
		x += tt_aV[OFFSETX];
	// Prevent tip from extending past right/left clientarea boundary
	if(x > tt_maxPosX)
		x = tt_maxPosX;
	return((x < tt_scrlX) ? tt_scrlX : x);
}
function tt_PosY()
{
	var y;

	// Apply some hysteresis after the tip has snapped to the other side of the
	// mouse. In case of insufficient space above and below the mouse, we place
	// the tip below.
	if(tt_aV[ABOVE] && (!tt_bJmpVert || tt_CalcPosYAbove() >= tt_scrlY + 16))
		y = tt_DoPosYAbove();
	else if(!tt_aV[ABOVE] && tt_bJmpVert && tt_CalcPosYBelow() > tt_maxPosY - 16)
		y = tt_DoPosYAbove();
	else
		y = tt_DoPosYBelow();
	// Snap to other side of mouse if tip would extend past window boundary
	if(y > tt_maxPosY)
		y = tt_DoPosYAbove();
	if(y < tt_scrlY)
		y = tt_DoPosYBelow();
	return y;
}
function tt_DoPosYBelow()
{
	tt_bJmpVert = tt_aV[ABOVE];
	return tt_CalcPosYBelow();
}
function tt_DoPosYAbove()
{
	tt_bJmpVert = !tt_aV[ABOVE];
	return tt_CalcPosYAbove();
}
function tt_CalcPosYBelow()
{
	return(tt_musY + tt_aV[OFFSETY]);
}
function tt_CalcPosYAbove()
{
	var dy = tt_aV[OFFSETY] - (tt_aV[SHADOW] ? tt_aV[SHADOWWIDTH] : 0);
	if(tt_aV[OFFSETY] > 0 && dy <= 0)
		dy = 1;
	return(tt_musY - tt_h - dy);
}
function tt_OnOut()
{
	tt_AddRemOutFnc(false);
	if(!(tt_aV[STICKY] && (tt_iState & 0x2)))
		tt_HideInit();
}
function tt_HideInit()
{
	tt_ExtCallFncs(0, "HideInit");
	tt_iState &= ~0x4;
	if(tt_flagOpa && tt_aV[FADEOUT])
	{
		tt_tFade.EndTimer();
		if(tt_opa)
		{
			var n = Math.round(tt_aV[FADEOUT] / (tt_aV[FADEINTERVAL] * (tt_aV[OPACITY] / tt_opa)));
			tt_Fade(tt_opa, tt_opa, 0, n);
			return;
		}
	}
	tt_tHide.Timer("tt_Hide();", 1, false);

}
function tt_OpReHref()
{
	if(tt_elDeHref)
	{
		tt_elDeHref.setAttribute("href", tt_elDeHref.t_href);
		tt_RemEvtFnc(tt_elDeHref, "mousedown", tt_OpReHref);
		window.status = tt_elDeHref.t_stats;
		tt_elDeHref = null;
	}
}
function tt_Fade(a, now, z, n)
{
	if(n)
	{
		now += Math.round((z - now) / n);
		if((z > a) ? (now >= z) : (now <= z))
			now = z;
		else
			tt_tFade.Timer("tt_Fade("
							+ a + "," + now + "," + z + "," + (n - 1)
							+ ")",
							tt_aV[FADEINTERVAL],
							true);
	}
	now ? tt_SetTipOpa(now) : tt_Hide();
}
// To circumvent the opacity nesting flaws of IE, we set the opacity
// for each sub-DIV separately, rather than for the container DIV.
function tt_SetTipOpa(opa)
{
	tt_SetOpa(tt_aElt[5].style, opa);
	if(tt_aElt[1])
		tt_SetOpa(tt_aElt[1].style, opa);
	if(tt_aV[SHADOW])
	{
		opa = Math.round(opa * 0.8);
		tt_SetOpa(tt_aElt[7].style, opa);
		tt_SetOpa(tt_aElt[8].style, opa);
	}
}
function tt_OnCloseBtnOver(iOver)
{
	var css = tt_aElt[4].style;

	iOver <<= 1;
	css.background = tt_aV[CLOSEBTNCOLORS][iOver];
	css.color = tt_aV[CLOSEBTNCOLORS][iOver + 1];
}
function tt_Int(x)
{
	var y;

	return(isNaN(y = parseInt(x)) ? 0 : y);
}
// Adds or removes the document.mousemove or HoveredElem.mouseout handler
// conveniently. Keeps track of those handlers to prevent them from being
// set or removed redundantly.
function tt_AddRemOutFnc(bAdd)
{
	var PSet = bAdd ? tt_AddEvtFnc : tt_RemEvtFnc;

	if(bAdd != tt_AddRemOutFnc.bOn)
	{
		PSet(tt_over, "mouseout", tt_OnOut);
		tt_AddRemOutFnc.bOn = bAdd;
		if(!bAdd)
			tt_OpReHref();
	}
}
tt_AddRemOutFnc.bOn = false;
Number.prototype.Timer = function(s, iT, bUrge)
{
	if(!this.value || bUrge)
		this.value = window.setTimeout(s, iT);
}
Number.prototype.EndTimer = function()
{
	if(this.value)
	{
		window.clearTimeout(this.value);
		this.value = 0;
	}
}
function tt_SetOpa(css, opa)
{
	tt_opa = opa;
	if(tt_flagOpa == 1)
	{
		// Hack for bugs of IE:
		// A DIV cannot be made visible in a single step if an opacity < 100
		// has been applied while the DIV was hidden.
		// Moreover, in IE6, applying an opacity < 100 has no effect if the
		// concerned element has no layout (position, size, zoom, ...).
		if(opa < 100)
		{
			var bVis = css.visibility != "hidden";
			css.zoom = "100%";
			if(!bVis)
				css.visibility = "visible";
			css.filter = "alpha(opacity=" + opa + ")";
			if(!bVis)
				css.visibility = "hidden";
		}
		else
			css.filter = "";
	}
	else
	{
		opa /= 100.0;
		switch(tt_flagOpa)
		{
		case 2:
			css.KhtmlOpacity = opa; break;
		case 3:
			css.KHTMLOpacity = opa; break;
		case 4:
			css.MozOpacity = opa; break;
		case 5:
			css.opacity = opa; break;
		}
	}
}
function tt_MovDomNode(el, dadFrom, dadTo)
{
	if(dadFrom)
		dadFrom.removeChild(el);
	if(dadTo)
		dadTo.appendChild(el);
}
function tt_Err(sErr)
{
	if(tt_Debug)
		alert("Tooltip Script Error Message:\n\n" + sErr);
}

//===========  DEALING WITH EXTENSIONS	==============//
function tt_ExtCmdEnum()
{
	var s;

	// Add new command(s) to the commands enum
	for(var i in config)
	{
		s = "window." + i.toString().toUpperCase();
		if(eval("typeof(" + s + ") == tt_u"))
		{
			eval(s + " = " + tt_aV.length);
			tt_aV[tt_aV.length] = null;
		}
	}
}
function tt_ExtCallFncs(arg, sFnc)
{
	var b = false;
	for(var i = tt_aExt.length; i;)
	{--i;
		var fnc = tt_aExt[i]["On" + sFnc];
		// Call the method the extension has defined for this event
		if(fnc && fnc(arg))
			b = true;
	}
	return b;
}

tt_Init();


function add_to_cart(product_id,prodprice,prodtitle,cur_id)
{
	var url = "process.php";
	var params = "mode=AddToCart&ProdNum="+product_id+"&ProdPrice="+prodprice+"&ProdTitle="+escape(prodtitle)+"&cur_id="+cur_id;
	var response = AjaxAgent.call(url,"","",params);
	document.getElementById("marksheet_detail").innerHTML = response;
	//alert(response);
	//alert(item_added_message);

	//reload the marksheet_detail
	//var url = "process.php";
	//var params = "mode=reloadMarksheetDetail";
	//AjaxAgent.call(url,"","reload_marksheetdetail",params);

	return response;
}

function add_to_cart_layer(product_id,prodprice,prodtitle,cur_id)
{
	var url = "process.php";
	var params = "mode=AddToCart&ProdNum="+product_id+"&ProdPrice="+prodprice+"&ProdTitle="+escape(prodtitle)+"&cur_id="+cur_id;
	var response = AjaxAgent.call(url,"","",params);
	document.getElementById("marksheet_detail").innerHTML = response;
	//alert(response);
	//alert(item_added_message);

	//reload the marksheet_detail
	//var url = "process.php";
	//var params = "mode=reloadMarksheetDetail";
	//AjaxAgent.call(url,"","reload_marksheetdetail",params);
	window.location.reload();
	return response;
}

function delete_from_cart_layer(product_id)
{
	var url = "process.php";
	var params = "mode=DeleteFromCart&ProdNum="+product_id;
	var response = AjaxAgent.call(url,"","",params);
	//alert(response);
	document.getElementById("marksheet_detail").innerHTML = response;

	//alert(item_deleted_message);


	//reload the marksheet_detail
	//var url = "process.php";
	//var params = "mode=reloadMarksheetDetail";
	//AjaxAgent.call(url,"","reload_marksheetdetail",params);

	window.location.reload();

	return response;
}


function delete_from_cart(product_id)
{
	var url = "process.php";
	var params = "mode=DeleteFromCart&ProdNum="+product_id;
	var response = AjaxAgent.call(url,"","",params);
	//alert(response);
	document.getElementById("marksheet_detail").innerHTML = response;

	//alert(item_deleted_message);


	//reload the marksheet_detail
	//var url = "process.php";
	//var params = "mode=reloadMarksheetDetail";
	//AjaxAgent.call(url,"","reload_marksheetdetail",params);

	if(document.URL.search(/marksheet.php$/) != -1) {
		// Reload page because we are in the marksheet
		location.reload();
	}

	return response;
}

function switch_marksheet(product_id, price_original, product_name_original, currency) {
	var object = document.getElementById('link_'+product_id);

	if(object) {
		var img = object.firstChild;
		if(img.src.search(/merkzettel_2/) != -1) {
			// product is already in the marksheet
			var response = delete_from_cart(product_id);
			if(response) {
				rand_flt = Math.random();
				img.src = 'images/merkzettel_1.gif?' + rand_flt;
				img.alt = 'In den Merkzettel übernehmen';
				img.title = img.alt;
			}
		} else {
			// product is not in the marksheet yet
			var response = add_to_cart(product_id, price_original, product_name_original, currency);
			if(response) {
				rand_flt = Math.random();
				img.src = 'images/merkzettel_2.gif?' + rand_flt;
				img.alt = 'Vom Merkzettel entfernen';
				img.title = img.alt;
			}
		}
	} else {
	}

//	document.getElementById("marksheet_detail").innerHTML = response;
	return;
}

function switch_marksheet_bk(product_id, price_original, product_name_original, currency) {
	var object = document.getElementById('link_'+product_id);

	if(object) {
		var img = object.firstChild;
		if(img.innerHTML.search(/gemerkt/) != -1) {
			// product is already in the marksheet
			var response = delete_from_cart(product_id);
			if(response) {
				//rand_flt = Math.random();
				img.innerHTML = '<font class="Headline_brand_underline">merken</font>'
				//img.alt = 'In den Merkzettel übernehmen';
				//img.title = img.alt;
			}
		} else {
			// product is not in the marksheet yet
			var response = add_to_cart(product_id, price_original, product_name_original, currency);
			if(response) {
				//rand_flt = Math.random();
				//img.src = 'images/merkzettel_2.gif?' + rand_flt;
				
				img.innerHTML = '<font class="Headline_brand_underline_red">added</font>';
				
				//img.alt = 'Vom Merkzettel entfernen';
				//img.title = img.alt;
			}
		}
	} else {
	}

//	document.getElementById("marksheet_detail").innerHTML = response;
	return;
}

function delete_from_user_cart(product_id)
{
	var url = "process.php";
	var params = "mode=DeleteFromCart&ProdNum="+product_id;
	var response = AjaxAgent.call(url,"","",params);
	//alert(response);
	//alert(item_deleted_message);

	//reload the marksheet_detail
	//var url = "process.php";
	//var params = "mode=reloadMarksheetDetail";
	//AjaxAgent.call(url,"","reload_marksheetdetail",params);

	//window.location.href='marksheet.php';

	window.location.reload();

	return;
}


function delete_from_user_cart_layer(product_id)
{
	var url = "process.php";
	var params = "mode=DeleteFromCart&ProdNum="+product_id;
	var response = AjaxAgent.call(url,"","",params);
	//alert(response);
	//alert(item_deleted_message);

	//reload the marksheet_detail
	//var url = "process.php";
	//var params = "mode=reloadMarksheetDetail";
	//AjaxAgent.call(url,"","reload_marksheetdetail",params);

	//window.location.href='marksheet.php';

	window.location.reload();

	return;
}

function reload_marksheetdetail(output)
{
	document.getElementById("marksheet_detail").innerHTML = output;

}


function reload_marksheet_page()
{
	//reload the marksheet_detail
	var url = "process.php";
	var params = "mode=reloadMarksheetDetailPage";
	var output = AjaxAgent.call(url,"","",params);

	document.getElementById("marksheet_detail").innerHTML = output;

	return;
}


// #########  code from js/ajax.loading.js   ######### //

function getNextProductsAjax(page, cat, limit, bgclass, min, max)
{
	pageTracker._trackPageview(SITE_URL+"product.php?cat="+cat+"&page="+page); // for google analytic
	//alert(SITE_URL+"product.php?cat="+cat+"&page="+page);

	tt_Hide();
	
	document.getElementById("popupmaskloading").className=bgclass;
	var sort = document.getElementById("id_sort_select").value;
	var url = "product.php";
	if(limit==""){
		var params = "page="+page+"&cat="+cat+"&sort="+sort+"&GetIt=Ajax&min="+min+"&max="+max;
	}else{
		var params = "page="+page+"&cat="+cat+"&sort="+sort+"&limit="+limit+"&GetIt=Ajax&min="+min+"&max="+max;
	}
	AjaxAgent.call(url,"","getNextProductsAjaxResponse",params);
}

function getNextProductsAjaxResponse(output)
{
	//alert(output);
	window.scrollTo(0,0);
	var outputArr = output.split('||||'); 
	document.getElementById('products_center_id').innerHTML=outputArr[0];
	var output2=outputArr[0];
	var scriptMarker = "<!--JSCODE-->";
	var indexOfStart = 0;
	var indexOfMarker = 0;
	while ((indexOfMarker = output2.indexOf(scriptMarker, indexOfStart)) != -1) {
		indexOfStart = indexOfMarker + scriptMarker.length;
		var indexOfEnd = output2.indexOf(scriptMarker, indexOfStart);
		var substring = output2.substring(indexOfStart, indexOfEnd);
		eval(substring);
		indexOfStart = indexOfEnd + 1;
	}  	
	document.getElementById('ajax_filter').innerHTML=outputArr[1];

}

//  for partner product page......
function getNextPartnerProductsAjax(page, pid, limit, bgclass, min, max)
{
	pageTracker._trackPageview(SITE_URL+"partner_product.php?pid="+pid+"&page="+page); // for google analytic
	//alert(SITE_URL+"partner_product.php?pid="+pid+"&page="+page);

	document.getElementById("popupmaskloading").className=bgclass;
	var sort = document.getElementById("id_sort_select").value;
	var url = "partner_product.php";
	if(limit==""){
		var params = "page="+page+"&pid="+pid+"&sort="+sort+"&GetIt=Ajax&min="+min+"&max="+max;
	}else{
		var params = "page="+page+"&pid="+pid+"&sort="+sort+"&limit="+limit+"&GetIt=Ajax&min="+min+"&max="+max;
	}
	AjaxAgent.call(url,"","getNextPartnerProductsAjaxResponse",params);
}

function getNextPartnerProductsAjaxResponse(output)
{
	//alert(output);
	window.scrollTo(0,0);
	var outputArr = output.split('||||'); 
	document.getElementById('products_center_id').innerHTML=outputArr[0];
	var output2=outputArr[0];
	var scriptMarker = "<!--JSCODE-->";
	var indexOfStart = 0;
	var indexOfMarker = 0;
	while ((indexOfMarker = output2.indexOf(scriptMarker, indexOfStart)) != -1) {
		indexOfStart = indexOfMarker + scriptMarker.length;
		var indexOfEnd = output2.indexOf(scriptMarker, indexOfStart);
		var substring = output2.substring(indexOfStart, indexOfEnd);
		eval(substring);
		indexOfStart = indexOfEnd + 1;
	}  	
	document.getElementById('ajax_filter').innerHTML=outputArr[1];
}

function getNextResultAjax(page, cat, limit, bgclass, is_sort, min, max)
{
		pageTracker._trackPageview(SITE_URL+"result.php?cat="+cat+"&page="+page); // for google analytic
		//alert(SITE_URL+"result.php?cat="+cat+"&page="+page);
		
		document.getElementById("popupmaskloading").className=bgclass;
		var sort = document.getElementById("id_sort_select").value;
		var url = "result.php";
		if(arguments[4]=="yes"){
			var params = "page="+page+"&cat="+cat+"&sort="+sort+"&sortchange=yes&previous_value="+document.sortform.value+"&GetIt=Ajax&min="+min+"&max="+max;
		}else{
			if(limit==""){
				var params = "page="+page+"&cat="+cat+"&sort="+sort+"&GetIt=Ajax&min="+min+"&max="+max;
			}else{
				var params = "page="+page+"&cat="+cat+"&sort="+sort+"&limit="+limit+"&GetIt=Ajax&min="+min+"&max="+max;
			}
		}
		//alert(url+" = "+params);
		AjaxAgent.call(url,"","getNextResultAjaxResponse",params);
}

function getNextResultAjaxResponse(output)
{
	//alert(output);
	window.scrollTo(0,0);
	var outputArr = output.split('||||'); 
	document.getElementById('products_center_id').innerHTML=outputArr[0];
	var output2=outputArr[0];
	var scriptMarker = "<!--JSCODE-->";
	var indexOfStart = 0;
	var indexOfMarker = 0;
	while ((indexOfMarker = output2.indexOf(scriptMarker, indexOfStart)) != -1) {
		indexOfStart = indexOfMarker + scriptMarker.length;
		var indexOfEnd = output2.indexOf(scriptMarker, indexOfStart);
		var substring = output2.substring(indexOfStart, indexOfEnd);
		eval(substring);
		indexOfStart = indexOfEnd + 1;
	}  	
	document.getElementById('ajax_filter').innerHTML=outputArr[1];
}

function getNextMarkenResultAjax(page, cat, limit, bgclass, is_sort, min, max)
{
		pageTracker._trackPageview(SITE_URL+"marken_result.php?cat="+cat+"&page="+page); // for google analytic
		//alert(SITE_URL+"marken_result.php?cat="+cat+"&page="+page);
		
		document.getElementById("popupmaskloading").className=bgclass;
		var sort = document.getElementById("id_sort_select").value;
		var url = "marken_result.php";
		if(arguments[4]=="yes"){
			var params = "page="+page+"&cat="+cat+"&sort="+sort+"&sortchange=yes&previous_value="+document.sortform.value+"&GetIt=Ajax&min="+min+"&max="+max;
		}else{
			if(limit==""){
				var params = "page="+page+"&cat="+cat+"&sort="+sort+"&GetIt=Ajax&min="+min+"&max="+max;
			}else{
				var params = "page="+page+"&cat="+cat+"&sort="+sort+"&limit="+limit+"&GetIt=Ajax&min="+min+"&max="+max;
			}
		}
		//alert(url+" = "+params);
		AjaxAgent.call(url,"","getNextMarkenResultAjaxResponse",params);
}

function getNextMarkenResultAjaxResponse(output)
{
	//alert(output);
	window.scrollTo(0,0);
	var outputArr = output.split('||||'); 
	document.getElementById('products_center_id').innerHTML=outputArr[0];
	var output2=outputArr[0];
	var scriptMarker = "<!--JSCODE-->";
	var indexOfStart = 0;
	var indexOfMarker = 0;
	while ((indexOfMarker = output2.indexOf(scriptMarker, indexOfStart)) != -1) {
		indexOfStart = indexOfMarker + scriptMarker.length;
		var indexOfEnd = output2.indexOf(scriptMarker, indexOfStart);
		var substring = output2.substring(indexOfStart, indexOfEnd);
		eval(substring);
		indexOfStart = indexOfEnd + 1;
	}  	
	
	document.getElementById('ajax_filter').innerHTML=outputArr[1];
}

function SetCookie(name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function getArtDetailFilter(cat)
{
	var url = "process.php";
	var params = "mode=getArtDetailFilter&cat="+cat;
	AjaxAgent.call(url,"","getArtDetailFilterResponse",params);
}

function getArtDetailFilterResponse(output)
{
	document.getElementById('art_detail').innerHTML=output;
	//getLoadPriceFilterAjax();
}

function getLoadPriceFilterAjax()
{
	var url = "process.php";
	var params = "mode=getLoadPriceFilterAjax";
	AjaxAgent.call(url,"","getLoadPriceFilterAjaxResponse",params);
}


function getLoadPriceFilterAjaxResponse(output)
{
	document.getElementById('price_filter').innerHTML=output;
	getLoadOtherCategoryFilterAjax();
}


function getLoadOtherCategoryFilterAjax()
{
	var url = "process.php";
	var params = "mode=getLoadOtherCategoryFilterAjax";
	AjaxAgent.call(url,"","getLoadOtherCategoryFilterAjaxResponse",params);
}


function getLoadOtherCategoryFilterAjaxResponse(output)
{
	document.getElementById('other_category_filter').innerHTML=output;
	getLoadOurPartnerFilterAjax();
}


function getLoadOurPartnerFilterAjax()
{
	var url = "process.php";
	var params = "mode=getLoadOurPartnerFilterAjax";
	AjaxAgent.call(url,"","getLoadOurPartnerFilterAjaxResponse",params);
}


function getLoadOurPartnerFilterAjaxResponse(output)
{
	document.getElementById('our_partenrs').innerHTML=output;
}

function getSearchCategoryFilter()
{
	var url = "process.php";
	var params = "mode=getSearchCategoryFilter";
	AjaxAgent.call(url,"","getSearchCategoryFilterResponse",params);
}

function getSearchCategoryFilterResponse(output)
{
	document.getElementById('search_category_filter').innerHTML=output;
}

//
function getLoadPriceFilterAjaxResult()
{
	var url = "process.php";
	var params = "mode=getLoadPriceFilterAjaxResult";
	AjaxAgent.call(url,"","getLoadPriceFilterAjaxResultResponse",params);
}


function getLoadPriceFilterAjaxResultResponse(output)
{
	document.getElementById('price_filter').innerHTML=output;
	getLoadOtherCategoryFilterAjaxResult();
}


function getLoadOtherCategoryFilterAjaxResult()
{
	var url = "process.php";
	var params = "mode=getLoadOtherCategoryFilterAjaxResult";
	AjaxAgent.call(url,"","getLoadOtherCategoryFilterAjaxResultResponse",params);
}


function getLoadOtherCategoryFilterAjaxResultResponse(output)
{
	document.getElementById('other_category_filter').innerHTML=output;
	getLoadOurPartnerFilterAjaxResult();
}


function getLoadOurPartnerFilterAjaxResult()
{
	var url = "process.php";
	var params = "mode=getLoadOurPartnerFilterAjaxResult";
	AjaxAgent.call(url,"","getLoadOurPartnerFilterAjaxResultResponse",params);
}


function getLoadOurPartnerFilterAjaxResultResponse(output)
{
	document.getElementById('our_partenrs').innerHTML=output;
}



// #########  code from js/categorycontentslider.js   ######### //


//** Featured Content Slider script- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com.
//** May 2nd, 08'- Script rewritten and updated to 2.0.
//** June 12th, 08'- Script updated to v 2.3, which adds the following features:
			//1) Changed behavior of script to actually collapse the previous content when the active one is shown, instead of just tucking it underneath the later.
			//2) Added setting to reveal a content either via "click" or "mouseover" of pagination links (default is former).
			//3) Added public function for jumping to a particular slide within a Featured Content instance using an arbitrary link, for example.

//** July 11th, 08'- Script updated to v 2.4:
			//1) Added ability to select a particular slide when the page first loads using a URL parameter (ie: mypage.htm?myslider=4 to select 4th slide in "myslider")
			//2) Fixed bug where the first slide disappears when the mouse clicks or mouses over it when page first loads.

var featuredcontentslider={

//3 variables below you can customize if desired:
ajaxloadingmsg: '<div style="margin: 20px 0 0 20px"><img src="images/loading.gif" /> Fetching slider Contents. Please wait...</div>',
bustajaxcache: true, //bust caching of external ajax page after 1st request?
enablepersist: true, //persist to last content viewed when returning to page?

settingcaches: {}, //object to cache "setting" object of each script instance

jumpTo:function(fcsid, pagenumber){ //public function to go to a slide manually.
	this.turnpage(this.settingcaches[fcsid], pagenumber)
},

ajaxconnect:function(setting){
	var page_request = false
	if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
		try {
		page_request = new ActiveXObject("Msxml2.XMLHTTP")
		} 
		catch (e){
			try{
			page_request = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch (e){}
		}
	}
	else if (window.XMLHttpRequest) // if Mozilla, Safari etc
		page_request = new XMLHttpRequest()
	else
		return false
	var pageurl=setting.contentsource[1]
	page_request.onreadystatechange=function(){
		featuredcontentslider.ajaxpopulate(page_request, setting)
	}
	document.getElementById(setting.id).innerHTML=this.ajaxloadingmsg
	var bustcache=(!this.bustajaxcache)? "" : (pageurl.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
	page_request.open('GET', pageurl+bustcache, true)
	page_request.send(null)
},

ajaxpopulate:function(page_request, setting){
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
		document.getElementById(setting.id).innerHTML=page_request.responseText
		this.buildpaginate(setting)
	}
},

buildcontentdivs:function(setting){
	var alldivs=document.getElementById(setting.id).getElementsByTagName("div")
	for (var i=0; i<alldivs.length; i++){
		if (this.css(alldivs[i], "contentdiv", "check")){ //check for DIVs with class "contentdiv"
			setting.contentdivs.push(alldivs[i])
				alldivs[i].style.display="none" //collapse all content DIVs to begin with
		}
	}
},

buildpaginate:function(setting){
	this.buildcontentdivs(setting)
	var sliderdiv=document.getElementById(setting.id)
	var pdiv=document.getElementById("paginate-"+setting.id)
	var phtml=""
	var toc=setting.toc
	var nextprev=setting.nextprev
	if (typeof toc=="string" && toc!="markup" || typeof toc=="object"){
		for (var i=1; i<=setting.contentdivs.length; i++){
			phtml+='<a href="#'+i+'" class="toc">'+(typeof toc=="string"? toc.replace(/#increment/, i) : toc[i-1])+'</a>'
		if(i<2)
		{
		phtml+='<IMG SRC="images/animatedbanner_02.gif" WIDTH=22 HEIGHT=18>';
		}
		}
		phtml=(nextprev[0]!=''? '<a href="#prev" class="prev">'+nextprev[0]+'</a> ' : '') + phtml + (nextprev[1]!=''? '<a href="#next" class="next">'+nextprev[1]+'</a>' : '')
		pdiv.innerHTML=phtml
	}
	var pdivlinks=pdiv.getElementsByTagName("a")
	var toclinkscount=0 //var to keep track of actual # of toc links
	for (var i=0; i<pdivlinks.length; i++){
		if (this.css(pdivlinks[i], "toc", "check")){
			if (toclinkscount>setting.contentdivs.length-1){ //if this toc link is out of range (user defined more toc links then there are contents)
				pdivlinks[i].style.display="none" //hide this toc link
				continue
			}
			pdivlinks[i].setAttribute("rel", ++toclinkscount) //store page number inside toc link
			pdivlinks[i][setting.revealtype]=function(){
				featuredcontentslider.turnpage(setting, this.getAttribute("rel"))
				return false
			}
			setting.toclinks.push(pdivlinks[i])
		}
		else if (this.css(pdivlinks[i], "prev", "check") || this.css(pdivlinks[i], "next", "check")){ //check for links with class "prev" or "next"
			pdivlinks[i].onclick=function(){
				featuredcontentslider.turnpage(setting, this.className)
				return false
			}
		}
	}
	this.turnpage(setting, setting.currentpage, true)
	if (setting.autorotate[0]){ //if auto rotate enabled
		pdiv[setting.revealtype]=function(){
			featuredcontentslider.cleartimer(setting, window["fcsautorun"+setting.id])
		}
		sliderdiv["onclick"]=function(){ //stop content slider when slides themselves are clicked on
			featuredcontentslider.cleartimer(setting, window["fcsautorun"+setting.id])
		}
		setting.autorotate[1]=setting.autorotate[1]+(1/setting.enablefade[1]*50) //add time to run fade animation (roughly) to delay between rotation
	 this.autorotate(setting)
	}
},

urlparamselect:function(fcsid){
	var result=window.location.search.match(new RegExp(fcsid+"=(\\d+)", "i")) //check for "?featuredcontentsliderid=2" in URL
	return (result==null)? null : parseInt(RegExp.$1) //returns null or index, where index (int) is the selected tab's index
},

turnpage:function(setting, thepage, autocall){
	var currentpage=setting.currentpage //current page # before change
	var totalpages=setting.contentdivs.length
	var turntopage=(/prev/i.test(thepage))? currentpage-1 : (/next/i.test(thepage))? currentpage+1 : parseInt(thepage)
	turntopage=(turntopage<1)? totalpages : (turntopage>totalpages)? 1 : turntopage //test for out of bound and adjust
	if (turntopage==setting.currentpage && typeof autocall=="undefined") //if a pagination link is clicked on repeatedly
		return
	setting.currentpage=turntopage
	setting.contentdivs[turntopage-1].style.zIndex=++setting.topzindex
	this.cleartimer(setting, window["fcsfade"+setting.id])
	setting.cacheprevpage=setting.prevpage
	if (setting.enablefade[0]==true){
		setting.curopacity=0
		this.fadeup(setting)
	}
	if (setting.enablefade[0]==false){ //if fade is disabled, fire onChange event immediately (verus after fade is complete)
		setting.contentdivs[setting.prevpage-1].style.display="none" //collapse last content div shown (it was set to "block")
		setting.onChange(setting.prevpage, setting.currentpage)
	}
	setting.contentdivs[turntopage-1].style.visibility="visible"
	setting.contentdivs[turntopage-1].style.display="block"
	if (setting.prevpage<=setting.toclinks.length) //make sure pagination link exists (may not if manually defined via "markup", and user omitted)
		this.css(setting.toclinks[setting.prevpage-1], "selected", "remove")
	if (turntopage<=setting.toclinks.length) //make sure pagination link exists (may not if manually defined via "markup", and user omitted)
		this.css(setting.toclinks[turntopage-1], "selected", "add")
	setting.prevpage=turntopage
	if (this.enablepersist)
		this.setCookie("fcspersist"+setting.id, turntopage)
},

setopacity:function(setting, value){ //Sets the opacity of targetobject based on the passed in value setting (0 to 1 and in between)
	var targetobject=setting.contentdivs[setting.currentpage-1]
	if (targetobject.filters && targetobject.filters[0]){ //IE syntax
		if (typeof targetobject.filters[0].opacity=="number") //IE6
			targetobject.filters[0].opacity=value*100
		else //IE 5.5
			targetobject.style.filter="alpha(opacity="+value*100+")"
	}
	else if (typeof targetobject.style.MozOpacity!="undefined") //Old Mozilla syntax
		targetobject.style.MozOpacity=value
	else if (typeof targetobject.style.opacity!="undefined") //Standard opacity syntax
		targetobject.style.opacity=value
	setting.curopacity=value
},

fadeup:function(setting){
	if (setting.curopacity<1){
		this.setopacity(setting, setting.curopacity+setting.enablefade[1])
		window["fcsfade"+setting.id]=setTimeout(function(){featuredcontentslider.fadeup(setting)}, 50)
	}
	else{ //when fade is complete
		if (setting.cacheprevpage!=setting.currentpage) //if previous content isn't the same as the current shown div (happens the first time the page loads/ script is run)
			setting.contentdivs[setting.cacheprevpage-1].style.display="none" //collapse last content div shown (it was set to "block")
		setting.onChange(setting.cacheprevpage, setting.currentpage)
	}
},

cleartimer:function(setting, timervar){
	if (typeof timervar!="undefined"){
		clearTimeout(timervar)
		clearInterval(timervar)
		if (setting.cacheprevpage!=setting.currentpage){ //if previous content isn't the same as the current shown div
			setting.contentdivs[setting.cacheprevpage-1].style.display="none"
		}
	}
},

css:function(el, targetclass, action){
	var needle=new RegExp("(^|\\s+)"+targetclass+"($|\\s+)", "ig")
	if (action=="check")
		return needle.test(el.className)
	else if (action=="remove")
		el.className=el.className.replace(needle, "")
	else if (action=="add")
		el.className+=" "+targetclass
},

autorotate:function(setting){
 window["fcsautorun"+setting.id]=setInterval(function(){featuredcontentslider.turnpage(setting, "next")}, setting.autorotate[1])
},

getCookie:function(Name){ 
	var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
	if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value
	return null
},

setCookie:function(name, value){
	document.cookie = name+"="+value

},


init:function(setting){
	var persistedpage=this.getCookie("fcspersist"+setting.id) || 1
	var urlselectedpage=this.urlparamselect(setting.id) //returns null or index from: mypage.htm?featuredcontentsliderid=index
	this.settingcaches[setting.id]=setting //cache "setting" object
	setting.contentdivs=[]
	setting.toclinks=[]
	setting.topzindex=0
	setting.currentpage=urlselectedpage || ((this.enablepersist)? persistedpage : 1)
	setting.prevpage=setting.currentpage
	setting.revealtype="on"+(setting.revealtype || "click")
	setting.curopacity=0
	setting.onChange=setting.onChange || function(){}
	if (setting.contentsource[0]=="inline")
		this.buildpaginate(setting)
	if (setting.contentsource[0]=="ajax")
		this.ajaxconnect(setting)
}

}


// #########  code from images/loader.js   ######### //

var t_id = setInterval(animate,20);
var pos=0;
var dir=2;
var len=0;

function animate()
{
var elem = document.getElementById('progress');
if(elem != null) {
if (pos==0) len += dir;
if (len>32 || pos>79) pos += dir;
if (pos>79) len -= dir;
if (pos>79 && len==0) pos=0;
elem.style.left = pos;
elem.style.width = len;
}
}

function remove_loading() {
this.clearInterval(t_id);
var targelem = document.getElementById('loader_container');
targelem.style.display='none';
targelem.style.visibility='hidden';
var t_id = setInterval(animate,60);
}


// #########  code from images/preview_templates.js   ######### //

var offsetfrommouse=[15,25]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var displayduration=0; //duration in seconds image should remain visible. 0 for always.

var defaultimageheight = 40;	// maximum image size.
var defaultimagewidth = 40;	// maximum image size.

var timer;

function gettrailobj(){
if (document.getElementById)
return document.getElementById("preview_div").style
}

function gettrailobjnostyle(){
if (document.getElementById)
return document.getElementById("preview_div")
}


function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}


function hidetrail(){	
	gettrailobj().display= "none";
	document.onmousemove=""
	gettrailobj().left="-500px"
	clearTimeout(timer);
}

function showtrail(imagename,title,width,height){
	i = imagename
	t = title
	w = width
	h = height
	timer = setTimeout("show('"+i+"',t,w,h);",200);
}
function show(imagename,title,width,height){
 
    var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth - offsetfrommouse[0]
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	if( (navigator.userAgent.indexOf("Konqueror")==-1  || navigator.userAgent.indexOf("Firefox")!=-1 || (navigator.userAgent.indexOf("Opera")==-1 && navigator.appVersion.indexOf("MSIE")!=-1)) && (docwidth>650 && docheight>500)) {
		( width == 0 ) ? width = defaultimagewidth: '';
		( height == 0 ) ? height = defaultimageheight: '';
			
		width+=30
		height+=55
		defaultimageheight = height
		defaultimagewidth = width
	
		document.onmousemove=followmouse; 

		
		newHTML = '<div class="border_preview" style="width:'+  width +'px;height:'+ height +'px"><div id="loader_container"><div id="loader"><div align="center">Loading template preview...</div><div id="loader_bg"><div id="progress"> </div></div></div></div>';
		newHTML = newHTML + '<font size="2" face="Tahoma" color="#766a62"><b>' + ' '+title + '</b></font>'
		
    	newHTML = newHTML + '<div class="preview_temp_load"><img onload="javascript:remove_loading();" src="' + imagename + '" border="0"></div>';
		newHTML = newHTML + '</div>'; 
		
		if(navigator.userAgent.indexOf("MSIE")!=-1 && navigator.userAgent.indexOf("Opera")==-1 ){
			newHTML = newHTML+'<iframe src="about:blank" scrolling="no" frameborder="0" width="'+width+'" height="'+height+'"></iframe>';
		}		

		gettrailobjnostyle().innerHTML = newHTML;
		gettrailobj().display="block";
	}
}

function followmouse(e){

	var xcoord=offsetfrommouse[0]
	var ycoord=offsetfrommouse[1]

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	if (typeof e != "undefined"){
		if (docwidth - e.pageX < defaultimagewidth + 2*offsetfrommouse[0]){
			xcoord = e.pageX - xcoord - defaultimagewidth; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < defaultimageheight + 2*offsetfrommouse[1]){
			ycoord += e.pageY - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + e.pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < defaultimagewidth + 2*offsetfrommouse[0]){
			xcoord = event.clientX + truebody().scrollLeft - xcoord - defaultimagewidth; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (defaultimageheight + 2*offsetfrommouse[1])){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
	}
	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"

}


// #########  code from js/process_ajax.js   ######### //


/**************************************************************************************************************/
// Create xmlhttp object based on browsertype
function getHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
	  xmlhttp.overrideMimeType("text/xml"); 
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
/**************************************************************************************************************/
// Define global variables to be used throughout
var BackgroundtableBusy = false;
var BackgroundtableHttp = getHTTPObject();
var step1Over = false;
var row = "";

/**************************************************************************************************************/


function ChangeCountry(str)
{
	if (!BackgroundtableBusy)
	{
		var url = "process.php";		
		var params = "mode=GetStateSelectBox&q="+str+"&sid="+Math.random();

		BackgroundtableHttp.open("POST", url, true);

		//Send the proper header infomation along with the request
		BackgroundtableHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		BackgroundtableHttp.setRequestHeader("Content-length", params.length);

		BackgroundtableHttp.setRequestHeader("Connection", "close");

		BackgroundtableHttp.onreadystatechange = ChangeCountryResponse;

		BackgroundtableBusy = true;
		BackgroundtableHttp.send(params);
	}
}

function ChangeCountryResponse()
{
	if (BackgroundtableHttp.readyState == 4)
	{
		if (BackgroundtableHttp.responseText.indexOf('invalid') == -1)
		{
			try
			{
				var htmlRecord = BackgroundtableHttp.responseText;
				var outputArr = htmlRecord.split("|");
				document.getElementById("divCustomerInfo").innerHTML=outputArr[0]; 
				document.getElementById("CountryCode").value=outputArr[1]; 

				BackgroundtableBusy = false;
			} // end try 
			catch(e)
			{
				alert("Error: " + e) ;
			} // end try catch
		} // end if response index -1
	} // end if readystate 4
} // end tableresponse function

//---------------------------------------------------------------------------------------------
function checkUserAvailability(str)
{
	document.getElementById('divUserNameInfo').innerHTML="<img style='border:0px' src='js/loading.gif'>";
	
	if (!BackgroundtableBusy)
	{
		var url = "process.php";		
		var params = "mode=checkUserAvailability&q="+str+"&sid="+Math.random();

		BackgroundtableHttp.open("POST", url, true);

		//Send the proper header infomation along with the request
		BackgroundtableHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		BackgroundtableHttp.setRequestHeader("Content-length", params.length);

		BackgroundtableHttp.setRequestHeader("Connection", "close");

		BackgroundtableHttp.onreadystatechange = checkUserAvailabilityResponse;

		BackgroundtableBusy = true;
		BackgroundtableHttp.send(params);
	}
}

function checkUserAvailabilityResponse()
{
	if (BackgroundtableHttp.readyState == 4)
	{
		if (BackgroundtableHttp.responseText.indexOf('invalid') == -1)
		{
			try
			{
				var htmlRecord = BackgroundtableHttp.responseText;
				document.getElementById("divUserNameInfo").innerHTML=htmlRecord; 

				BackgroundtableBusy = false;
			} // end try 
			catch(e)
			{
				alert("Error: " + e) ;
			} // end try catch
		} // end if response index -1
	} // end if readystate 4
} // end tableresponse function

function DeleteMyPic()
{
	if (!BackgroundtableBusy)
	{
		var url = "process.php";		
		var params = "mode=DeleteMyPic&sid="+Math.random();

		BackgroundtableHttp.open("POST", url, true);

		//Send the proper header infomation along with the request
		BackgroundtableHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		BackgroundtableHttp.setRequestHeader("Content-length", params.length);

		BackgroundtableHttp.setRequestHeader("Connection", "close");
		
		document.getElementById('user_pic_div').innerHTML="Deleting...";

		BackgroundtableHttp.onreadystatechange = DeleteMyPicResponse;

		BackgroundtableBusy = true;
		BackgroundtableHttp.send(params);
	}
}

function DeleteMyPicResponse()
{
	if (BackgroundtableHttp.readyState == 4)
	{
		if (BackgroundtableHttp.responseText.indexOf('invalid') == -1)
		{
			try
			{
				var htmlRecord = BackgroundtableHttp.responseText;
				
				if(htmlRecord=="DONE")
				{
					document.getElementById('user_present_pic').style.display="none";
					alert("Das Bild wurde erfolgreich gelöscht!");
				}

				BackgroundtableBusy = false;
			} // end try 
			catch(e)
			{
				alert("Error: " + e) ;
			} // end try catch
		} // end if response index -1
	} // end if readystate 4
} // end tableresponse function

//---------------------------------------------------------------------------------------------
function sendMailToFriends(mode,product_id,fromname,fromemail,friendemails,personalmess)
{
	document.getElementById('emailsenddiv').innerHTML="<img src='js/loading.gif'>";
	if (!BackgroundtableBusy)
	{
		var url = "process.php";		
		var params = "mode="+mode+"&product_id="+product_id+"&fromname="+fromname+"&fromemail="+fromemail+"&friendemails="+friendemails+"&personalmess="+encodeURIComponent(personalmess);

		BackgroundtableHttp.open("POST", url, true);

		//Send the proper header infomation along with the request
		BackgroundtableHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		BackgroundtableHttp.setRequestHeader("Content-length", params.length);

		BackgroundtableHttp.setRequestHeader("Connection", "close");
		
		BackgroundtableHttp.onreadystatechange = sendMailToFriendsResponse;

		BackgroundtableBusy = true;
		BackgroundtableHttp.send(params);
	}
}

function sendMailToFriendsResponse()
{
	
	if (BackgroundtableHttp.readyState == 4)
	{
	//alert(BackgroundtableHttp.responseText);
		//if (BackgroundtableHttp.responseText.indexOf('invalid') == -1)
		//{
			try
			{
				
				
				var htmlRecord = BackgroundtableHttp.responseText;
				
				if(htmlRecord=='errordetail')
				{

				window.top.location='index.php';
				}
				else
				{
					document.getElementById('emailsenddiv').innerHTML=htmlRecord;
				}
				BackgroundtableBusy = false;
			} // end try 
			catch(e)
			{
				alert("Error: " + e) ;
			} // end try catch
		//} // end if response index -1
	} // end if readystate 4
} // end tableresponse function

//---------------------------------------------------------------------------------------------
function ShowImport(importoption)
{
	document.getElementById('showimportsemail').innerHTML="<img style='border:0px' src='js/loading.gif'>";

	if (!BackgroundtableBusy)
	{
		var url = "process.php";		
		var params = "mode=ShowImport&importoption="+importoption;

		BackgroundtableHttp.open("POST", url, true);

		//Send the proper header infomation along with the request
		BackgroundtableHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		BackgroundtableHttp.setRequestHeader("Content-length", params.length);

		BackgroundtableHttp.setRequestHeader("Connection", "close");
		
		BackgroundtableHttp.onreadystatechange = ShowImportResponse;

		BackgroundtableBusy = true;
		BackgroundtableHttp.send(params);
	}
}

function ShowImportResponse()
{
	if (BackgroundtableHttp.readyState == 4)
	{
		if (BackgroundtableHttp.responseText.indexOf('invalid') == -1)
		{
			try
			{
				var htmlRecord = BackgroundtableHttp.responseText;
				
				// Draw Record status and nav buttons
				var outputArr = new Array();
				outputArr = htmlRecord.split(":--");
				document.getElementById('importimages').innerHTML=outputArr[0];
				document.getElementById('showimportsemail').innerHTML=outputArr[1];

				BackgroundtableBusy = false;
			} // end try 
			catch(e)
			{
				alert("Error: " + e) ;
			} // end try catch
		} // end if response index -1
	} // end if readystate 4
} // end tableresponse function

//---------------------------------------------------------------------------------------------
function ImportEmails(spimport,username,password)
{
	document.getElementById('processdiv').innerHTML="<img style='border:0px' src='js/loading.gif'>";

	if (!BackgroundtableBusy)
	{
		var url = "process.php";		
		var params = "mode=ImportEmails&spimport="+spimport+"&username="+username+"&password="+password;

		BackgroundtableHttp.open("POST", url, true);

		//Send the proper header infomation along with the request
		BackgroundtableHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		BackgroundtableHttp.setRequestHeader("Content-length", params.length);

		BackgroundtableHttp.setRequestHeader("Connection", "close");
		
		BackgroundtableHttp.onreadystatechange = ImportEmailsResponse;

		BackgroundtableBusy = true;
		BackgroundtableHttp.send(params);
	}
}

function ImportEmailsResponse()
{
	if (BackgroundtableHttp.readyState == 4)
	{
		if (BackgroundtableHttp.responseText.indexOf('invalid') == -1)
		{
			try
			{
				var htmlRecord = BackgroundtableHttp.responseText;
				
				// Draw Record status and nav buttons
				document.getElementById('processdiv').innerHTML="";
				document.getElementById('showimportsemail').innerHTML=htmlRecord;

				BackgroundtableBusy = false;
			} // end try 
			catch(e)
			{
				alert("Error: " + e) ;
			} // end try catch
		} // end if response index -1
	} // end if readystate 4
} // end tableresponse function

//---------------------------------------------------------------------------------------------
function ForgotMyPassword()
{
	var email = document.getElementById('forgot_email').value;
	
	if(Trim(email)=="")
	{
		alert("Bitte Ihre Email eingeben!");
		return false;
	}
	
	if(EmailCheckjs(email)==false)
	{
		alert("Ungültige Email-Adresse!");
		return false;
	}
	document.getElementById('forgot_pass').innerHTML="<img style='border:0px' src='js/loading.gif'>";

	if (!BackgroundtableBusy)
	{
		var url = "process.php";		
		var params = "mode=ForgotPassword&email="+escape(email)+"&sid="+Math.random();

		BackgroundtableHttp.open("POST", url, true);

		//Send the proper header infomation along with the request
		BackgroundtableHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		BackgroundtableHttp.setRequestHeader("Content-length", params.length);

		BackgroundtableHttp.setRequestHeader("Connection", "close");
		
		BackgroundtableHttp.onreadystatechange = ForgotMyPasswordResponse;

		BackgroundtableBusy = true;
		BackgroundtableHttp.send(params);
	}
}

function ForgotMyPasswordResponse()
{
	if (BackgroundtableHttp.readyState == 4)
	{
		if (BackgroundtableHttp.responseText.indexOf('invalid') == -1)
		{
			try
			{
				var htmlRecord = BackgroundtableHttp.responseText;
				
				document.getElementById('forgot_pass').innerHTML=htmlRecord;

				BackgroundtableBusy = false;
			} // end try 
			catch(e)
			{
				alert("Error: " + e) ;
			} // end try catch
		} // end if response index -1
	} // end if readystate 4
} // end tableresponse function

function DeleteCommunityPic(groupId)
{
	if (!BackgroundtableBusy)
	{
		var url = "process.php";		
		var params = "mode=DeleteCommunityPic&gId="+groupId+"&sid="+Math.random();

		BackgroundtableHttp.open("POST", url, true);

		//Send the proper header infomation along with the request
		BackgroundtableHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		BackgroundtableHttp.setRequestHeader("Content-length", params.length);

		BackgroundtableHttp.setRequestHeader("Connection", "close");
		
		document.getElementById('user_pic_div').innerHTML="Deleting...";

		BackgroundtableHttp.onreadystatechange = DeleteCommunityPicResponse;

		BackgroundtableBusy = true;
		BackgroundtableHttp.send(params);
	}
}

function DeleteCommunityPicResponse()
{
	if (BackgroundtableHttp.readyState == 4)
	{
		if (BackgroundtableHttp.responseText.indexOf('invalid') == -1)
		{
			try
			{
				var htmlRecord = BackgroundtableHttp.responseText;
				
				if(htmlRecord=="DONE")
				{
					document.getElementById('user_present_pic').style.display="none";
					alert("Das Bild wurde erfolgreich entfernt!");
				}

				BackgroundtableBusy = false;
			} // end try 
			catch(e)
			{
				alert("Error: " + e) ;
			} // end try catch
		} // end if response index -1
	} // end if readystate 4
} // end tableresponse function

//---------------------------------Model------------------------------------------------------------
function sendMailModelToFriends(mode,vname,name1,email,email1,email2,email3,personalmess)
{
	document.getElementById('emailmodelsenddiv').innerHTML="<img src='js/loading.gif'>";
	if (!BackgroundtableBusy)
	{
		var url = "process.php";		
		var params = "mode="+mode+"&vname="+vname+"&name1="+name1+"&email="+email+"&email1="+email1+"&email2="+email2+"&email3="+email3+"&personalmess="+encodeURIComponent(personalmess);

		BackgroundtableHttp.open("POST", url, true);

		//Send the proper header infomation along with the request
		BackgroundtableHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		BackgroundtableHttp.setRequestHeader("Content-length", params.length);

		BackgroundtableHttp.setRequestHeader("Connection", "close");
		
		BackgroundtableHttp.onreadystatechange = sendModelToFriendsResponse;

		BackgroundtableBusy = true;
		BackgroundtableHttp.send(params);
	}
}

function sendModelToFriendsResponse()
{
	if (BackgroundtableHttp.readyState == 4)
	{
		if (BackgroundtableHttp.responseText.indexOf('invalid') == -1)
		{
			try
			{
				var htmlRecord = BackgroundtableHttp.responseText;
				
				document.getElementById('emailmodelsenddiv').innerHTML=htmlRecord;

				BackgroundtableBusy = false;
			} // end try 
			catch(e)
			{
				alert("Error: " + e) ;
			} // end try catch
		} // end if response index -1
	} // end if readystate 4
} // end tableresponse function

//-------------------------------------end model--------------------------------------------------------


//---------------------------------loadjs------------------------------------------------------------
function locadvideottrenwalk(TbID,LID)
{
	document.getElementById('popupmaskloading_t').innerHTML="<img src='js/loading_big.gif'>";
	document.getElementById("popupmaskloading_t").className='popupMaskForLoading_trend';
	
	
	
	if (!BackgroundtableBusy)
	{
		var url = "trendwalk_ajax.php";	
		
		
		var params = "TbID="+TbID+"&LID="+LID;

		BackgroundtableHttp.open("POST", url, true);

		//Send the proper header infomation along with the request
		BackgroundtableHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		BackgroundtableHttp.setRequestHeader("Content-length", params.length);

		BackgroundtableHttp.setRequestHeader("Connection", "close");
		
		BackgroundtableHttp.onreadystatechange = sendrepondtrendwalk;

		BackgroundtableBusy = true;
		BackgroundtableHttp.send(params);
		if(document.getElementById("selectedVideo").value!="")
		{
			var selectId=document.getElementById("selectedVideo").value;
			document.getElementById("i_"+selectId).style.width="75px";
			document.getElementById("i_"+selectId).style.height="93px";
			document.getElementById("i_"+selectId).className="";

			document.getElementById("i_"+LID).style.width="71px";
			document.getElementById("i_"+LID).style.height="89px";
			document.getElementById("i_"+LID).className="trendwalkborder";
		}
		else
		{
			document.getElementById("i_"+LID).style.width="71px";
			document.getElementById("i_"+LID).style.height="89px";
			document.getElementById("i_"+LID).className="trendwalkborder";
		}
		document.getElementById("selectedVideo").value=LID;
	}
	
	
}

function sendrepondtrendwalk()
{
	
	
	
	if (BackgroundtableHttp.readyState == 4)
	{
		if (BackgroundtableHttp.responseText.indexOf('invalid') == -1)
		{
			try
			{
				var htmlRecord = BackgroundtableHttp.responseText;
				
				
				
				document.getElementById('loadcontent').innerHTML=htmlRecord;
				document.getElementById("popupmaskloading_t").className='';
				document.getElementById('popupmaskloading_t').innerHTML="";

				BackgroundtableBusy = false;
			} // end try 
			catch(e)
			{
				alert("Error: " + e) ;
			} // end try catch
		} // end if response index -1
	} // end if readystate 4
} // end tableresponse function

//-------------------------------------end model--------------------------------------------------------

function showhide(proid)
{




var col_array=document.getElementById("proarray").value.split(",");
 //alert( col_array.length);

var part_num=0;
while (part_num < col_array.length)
 {
  //alert(col_array[part_num]);
 
 if(proid==col_array[part_num])
 {
	
	 var divid='p_'+proid;
	 var tableid='t_'+proid;
	 document.getElementById(divid).style.display='inline';
	 
	 document.getElementById(tableid).className='trendwalkborder';
 
 }
 else
 {
	 var divid='p_'+col_array[part_num];
	 var tableid='t_'+col_array[part_num];
	 document.getElementById(divid).style.display='none';
	  document.getElementById(tableid).className='trendwalkborder1';
 }
 
 
 part_num+=1;
  }

}

// #########  code from js/.js   ######### //

