var url = "";

function SetLanguage(selection){
	url = "?mod=setlanguage&language=" + selection + "&red=" + strQueryStrings;
	document.location = url;
}


function PopImage2(type,id, place){
	window.open("image.asp?type=" + type + "&id=" + id + "&place=" + place,"image","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=1,height=1,left = 0,top = 0");
}

function PopImageResize(type,id, place)  {

if (document.all){
	var genislikmax = 300;
    var yukseklikmax = 560;
	var genislikArtir = 8;
	var yukseklikArtir = 4;  
	var yenipencere = window.open("image.asp?type=" + type + "&id=" + id + "&place=" + place,"image","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=50,left = 40,top = 10");
	for (yukseklik = 1 ; yukseklik < yukseklikmax; yukseklik += yukseklikArtir)
	{		yenipencere.resizeTo("1",yukseklik);	}
	for (genislik = 1 ; genislik < genislikmax; genislik += genislikArtir)
	{	yenipencere.resizeTo(genislik , yukseklik);	}       
	yenipencere.location = adres;
}
else
{	window.location = type,id, place;}
}

function openPictureWindow_Scud(image,alt) {
	newWindow = window.open("","newWindow","width=80,height=80");
	newWindow.document.open();
	newWindow.document.write('<html><head><title>'+alt+'</title><scr'+'ipt language="javascr'+'ipt">function boyutlandir(scud){genislik=eval(scud.offsetWidth)+8;yukseklik=eval(scud.offsetHeight)+27;window.resizeTo(genislik,yukseklik);yenix=(screen.availWidth-genislik)/2;yeniy=(screen.availHeight-yukseklik)/2;if (yeniy<15){ yeniy=15;}');
	newWindow.document.write('window.moveTo(yenix,yeniy);}</scr'+'ipt></head><body bgcolor=#000000 leftmargin=0 topmargin=0 marginheight=0 marginwidth=0 onload="window.setTimeout(\'self.close\',20000)" onresize="boyutlandir(resim)" onload="boyutlandir(resim)">');
	newWindow.document.write('<img src='+image+' id=resim onload="boyutlandir(resim)" alt=""><scr'+'ipt language="javascr'+'ipt">boyutlandir(resim);</scr'+'ipt>');
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function SearchMan(selection){
	url = "?mod=search&type=advanced&man_id=" + selection;
	document.location = url;
}

function addToCart(product_id, field_id){
	var quant = document.getElementById("products_to_alter_" + field_id).value;
	if(quant!=0){
		document.location = "?mod=cart&action=add&id=" + product_id + "&quant=" + quant;
	}
}

function deleteFromCart(cookie_id, field_id){
	var quant = document.getElementById("products_to_alter_" + field_id).value;
	if(quant!=0){
		document.location = "?mod=cart&action=delete&id=" + cookie_id + "&quant=" + quant;
	}
}

function showError(number, source, description){
	div_name = "errordiv";
	document.getElementById(div_name).style.visibility = "";
}

<!--

/*
Image w/ description tooltip- By Dynamic Web Coding (www.dyn-web.com)
Copyright 2002 by Sharon Paine
Visit http://www.dynamicdrive.com for this script
*/

/* IMPORTANT: Put script after tooltip div or 
	 put tooltip div just before </BODY>. */

var dom = (document.getElementById) ? true : false;
var ns5 = ((navigator.userAgent.indexOf("Gecko")>-1) && dom) ? true: false;
var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
var ns4 = (document.layers && !dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;
var nodyn = (!ns5 && !ns4 && !ie4 && !ie5) ? true : false;

// resize fix for ns4
var origWidth, origHeight;
if (ns4) {
	origWidth = window.innerWidth; origHeight = window.innerHeight;
	window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

// avoid error of passing event object in older browsers
if (nodyn) { event = "nope" }

///////////////////////  CUSTOMIZE HERE   ////////////////////
// settings for tooltip 
// Do you want tip to move when mouse moves over link?
var tipFollowMouse= true;	
// Be sure to set tipWidth wide enough for widest image
var tipWidth= 160;
var offX= 40;	// how far from mouse to show tip
var offY= 12; 
var tipFontFamily= "Verdana, arial, helvetica, sans-serif";
var tipFontSize= "8pt";
// set default text color and background color for tooltip here
// individual tooltips can have their own (set in messages arrays)
// but don't have to
var tipFontColor= "#000000";
var tipBgColor= "#000000"; 
var tipBorderColor= "#000000";
var tipBorderWidth= 1;
var tipBorderStyle= "ridge";
var tipPadding= 1;



////////////////////  END OF CUSTOMIZATION AREA  ///////////////////



// to layout image and text, 2-row table, image centered in top cell
// these go in var tip in doTooltip function
// startStr goes before image, midStr goes between image and text
var startStr = '<table width="' + tipWidth + '"><tr><td align="center" width="100%"><img src="';
var midStr = '" border="0"></td></tr><tr><td valign="top">';
var endStr = '</td></tr></table>';

////////////////////////////////////////////////////////////
//  initTip	- initialization for tooltip.
//		Global variables for tooltip. 
//		Set styles for all but ns4. 
//		Set up mousemove capture if tipFollowMouse set true.
////////////////////////////////////////////////////////////
var tooltip, tipcss;
initTip = function() {
	if (nodyn) return;
	tooltip = (ns4)? document.tipDiv.document: (ie4)? document.all['tipDiv']: (ie5||ns5)? document.getElementById('tipDiv'): null;
	tipcss = (ns4)? document.tipDiv: tooltip.style;
	if (ie4||ie5||ns5) {	// ns4 would lose all this on rewrites
		tipcss.width = tipWidth+"px";
		tipcss.fontFamily = tipFontFamily;
		tipcss.fontSize = tipFontSize;
		tipcss.color = tipFontColor;
		tipcss.backgroundColor = tipBgColor;
		tipcss.borderColor = tipBorderColor;
		tipcss.borderWidth = tipBorderWidth+"px";
		tipcss.padding = tipPadding+"px";
		tipcss.borderStyle = tipBorderStyle;
	}
	if (tooltip&&tipFollowMouse) {
		if (ns4) document.captureEvents(Event.MOUSEMOVE);
		document.onmousemove = trackMouse;
	}
}

window.onload=initTip;

/////////////////////////////////////////////////
//  doTooltip function
//			Assembles content for tooltip and writes 
//			it to tipDiv
/////////////////////////////////////////////////
var t1,t2;	// for setTimeouts
var tipOn = false;	// check if over tooltip link
function doTooltip(evt,image, text, bgcolor, color) {
	if (!tooltip) return;
	if (t1) clearTimeout(t1);	if (t2) clearTimeout(t2);
	tipOn = true;
	// set colors if included in messages array
	if (bgcolor)	var curBgColor = bgcolor;
	else curBgColor = tipBgColor;
	if (color)	var curFontColor = color;
	else curFontColor = tipFontColor;
	if (ns4) {
		var tip = '<table bgcolor="' + tipBorderColor + '" width="' + tipWidth + '" cellspacing="0" cellpadding="' + tipBorderWidth + '" border="0"><tr><td><table bgcolor="' + curBgColor + '" width="100%" cellspacing="0" cellpadding="' + tipPadding + '" border="0"><tr><td>'+ startStr + image + midStr + '<span style="font-family:' + tipFontFamily + '; font-size:' + tipFontSize + '; color:' + curFontColor + ';">' + text + '</span>' + endStr + '</td></tr></table></td></tr></table>';
		tooltip.write(tip);
		tooltip.close();
	} else if (ie4||ie5||ns5) {
		var tip = startStr + image + midStr + '<span style="font-family:' + tipFontFamily + '; font-size:' + tipFontSize + '; color:' + curFontColor + ';">' + text + '</span>' + endStr;
		tipcss.backgroundColor = curBgColor;
	 	tooltip.innerHTML = tip;
	}
	if (!tipFollowMouse) positionTip(evt);
	else t1=setTimeout("tipcss.visibility='visible'",100);
}

var mouseX, mouseY;
function trackMouse(evt) {
	mouseX = (ns4||ns5)? evt.pageX: window.event.clientX + document.body.scrollLeft;
	mouseY = (ns4||ns5)? evt.pageY: window.event.clientY + document.body.scrollTop;
	if (tipOn) positionTip(evt);
}

/////////////////////////////////////////////////////////////
//  positionTip function
//		If tipFollowMouse set false, so trackMouse function
//		not being used, get position of mouseover event.
//		Calculations use mouseover event position, 
//		offset amounts and tooltip width to position
//		tooltip within window.
/////////////////////////////////////////////////////////////
function positionTip(evt) {
	if (!tipFollowMouse) {
		mouseX = (ns4||ns5)? evt.pageX: window.event.clientX + document.body.scrollLeft;
		mouseY = (ns4||ns5)? evt.pageY: window.event.clientY + document.body.scrollTop;
	}
	// tooltip width and height
	var tpWd = (ns4)? tooltip.width: (ie4||ie5)? tooltip.clientWidth: tooltip.offsetWidth;
	var tpHt = (ns4)? tooltip.height: (ie4||ie5)? tooltip.clientHeight: tooltip.offsetHeight;
	// document area in view (subtract scrollbar width for ns)
	var winWd = (ns4||ns5)? window.innerWidth-20+window.pageXOffset: document.body.clientWidth+document.body.scrollLeft;
	var winHt = (ns4||ns5)? window.innerHeight-20+window.pageYOffset: document.body.clientHeight+document.body.scrollTop;
	// check mouse position against tip and window dimensions
	// and position the tooltip 
	if ((mouseX+offX+tpWd)>winWd) 
		tipcss.left = (ns4)? mouseX-(tpWd+offX): mouseX-(tpWd+offX)+"px";
	else tipcss.left = (ns4)? mouseX+offX: mouseX+offX+"px";
	if ((mouseY+offY+tpHt)>winHt) 
		tipcss.top = (ns4)? winHt-(tpHt+offY): winHt-(tpHt+offY)+"px";
	else tipcss.top = (ns4)? mouseY+offY: mouseY+offY+"px";
	if (!tipFollowMouse) t1=setTimeout("tipcss.visibility='visible'",100);
}

function hideTip() {
	if (!tooltip) return;
	t2=setTimeout("tipcss.visibility='hidden'",100);
	tipOn = false;
}

function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

function switchBox(div_name){
	mCart_status = getCookie(div_name + "_status");
	mCart = document.getElementById(div_name + "_content");
	
	if(mCart_status == "collapsed"){
		document.cookie = div_name + "_status=open";
		mCart.style.display = "block";
	} else {
		document.cookie = div_name + "_status=collapsed";
		mCart.style.display = "none";
	}
}

startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("menulist");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}
window.onload=startList;
