var glob_error=false;
var lastKnownFieldValue="";
var issetPopupPos=false;
//var browser=getBrowsername();

function get_Obj(obj)
{
	var subm=document.getElementById(obj);
	
	return subm;
}

function AreYouSure(Query)
{
	switch(Query) {
		case 1:
			confirmMsg="Sind sie sicher, dass sie den Datensatz entfernen wollen?";
			break;
		case 2:
			confirmMsg="Sind sie sicher, dass sie alle Datens&auml;tze entfernen wollen?";
			break;
		case 3:
			confirmMsg="Sind sie sicher, dass sie das Bild entfernen wollen?";
			break;
		case 4:
			confirmMsg="Sind sie sicher, dass sie diesen Artikel l&ouml;schen m&ouml;chten?";
			break;
		case 5:
			confirmMsg="Sind sie sicher, dass sie den TradeManager beenden mchten?";
			break;
	}
   	return confirm(confirmMsg);
}
function ConfirmMsg(Query, URL)
{
   	if(AreYouSure(Query)) window.location.href = URL;
}
function ConfirmTextMsg(Text, URL)
{
   	if(confirm(Text)) window.location.href = URL;
}
function check_agb()
{
   	var agb=get_Obj("agb");
   	var sbm=get_Obj("submit_order");
	if(agb.checked)
	{
		sbm.src="../img/buttons/btn_order2.png";
		sbm.disabled=false;
	}
	else	
	{
		sbm.src="../img/buttons/btn_order2_gray.png";
		sbm.disabled=true;
	}
}


function hidebox(box)
{
	var obj=getObj(box);
	if(obj!=null)
	{
		//obj.style.visibility="hidden";
		obj.style.display="none";
	}
}
function showbox(box)
{
	getObj(box).style.display="inline";//visibility="visible";
}

function set_value(dest,value)
{
	get_Obj(dest).value=value;
}

function edit_helptext(obj,text,color1,color2,mode)
{
	if(mode=='IN')
	{
		if(obj.value==text)
		{
			obj.value='';
		}
		obj.style.color=color1;
	}
	else if(mode=='OUT')
	{
		if(obj.value=='')
		{
			obj.value=text;
			obj.style.color=color2;
		}
	}
}

function redirection(URL,time) 
{
	window.setTimeout("do_redirection('"+URL+"')", time);
}

function do_redirection(URL) 
{ 
   location.href=URL; 
}

var currPopup=new Array();

function hidePopup(objDiv)
{
	if(objDiv==null)
	{
		if(currPopup!="")
		{
			currPopup.style.display='none';
		}
		//objDiv=currPopup;
	}
	else if(objDiv!="")
	{
		objDiv.style.display='none';	
	}
}

function showDynBox(divId,x_,y_)
{
	var objDiv=getObj(divId);
	if(window.event!=null)
	{
		x_=x_==null ? 0 : x_;
		y_=y_==null ? 0 : y_;
		var maus=mausPos(window.event);
		objDiv.style.position='absolute';
		objDiv.style.display='inline';
		var objWidth=objDiv.offsetWidth;
		var objHeight=objDiv.offsetHeight;
		e = window.event;
		maus[0] = (e) ? e.clientX + document.documentElement.scrollLeft : e.pageX + e.clientX;
		maus[1] = (e) ? e.clientY + document.documentElement.scrollTop : e.pageY + e.clientY;
		/*if(maus[0]+objWidth-document.documentElement.scrollLeft > document.documentElement.clientWidth)
			maus[0]=maus[0]-objWidth-x_-4;
		if(maus[1]+objHeight-document.documentElement.scrollTop > document.documentElement.clientHeight)
			maus[1]=maus[1]-objHeight-y_;*/
			
		objDiv.style.left=maus[0]+x_+'px';
		objDiv.style.top=maus[1]+y_+'px';
		currPopup=objDiv;
	}
	else
	{
		objDiv.style.display='inline';
	}
}

function showFixBox(divId)
{
	var objDiv=getObj(divId);
	objDiv.style.display='inline';
}

function showContentBox(divId,DontSetPos)
{
	var objDiv=getObj(divId);
	var objDivFrm=getObj(divId+"_iframe");
	var boxHeight=objDivFrm!=null ? objDivFrm.clientHeight+15+20 : 0;
	objDiv.style.display='inline';
	if(!DontSetPos && !issetPopupPos)
	{
		objDiv.style.top=(document.documentElement.scrollTop>0 ? 50+document.documentElement.scrollTop : 150)+'px';
		objDiv.style.left=(100+document.documentElement.scrollLeft)+'px';
	}
	ob_pos_top=objPosTop(objDiv);
	if(ob_pos_top<document.documentElement.scrollTop && document.documentElement.scrollTop > 0)
	{
		objDiv.style.top=document.documentElement.scrollTop+20;
	}
	else if(ob_pos_top-document.documentElement.scrollTop+boxHeight>document.documentElement.clientHeight)
	{
		objDiv.style.top=document.documentElement.scrollTop+20;		 
	}
	issetPopupPos=true;
}

function hideBox(box)
{
	var obj=getObj(box);
	if(obj!=null)
	{
		//obj.style.visibility="hidden";
		obj.style.display="none";
	}
}
function divPopup(divId,pid)
{
	pid=pid!=null ? pid : '1';
	var objDiv=getObj(divId);
	if(currPopup!=null && currPopup!=divId)// && pid=='1'
	{
		hidePopup(currPopup);	
	}
	if(pid=='1' && window.event!=null)
	{
		var maus=mausPos(window.event);
		objDiv.style.position='absolute';
		objDiv.style.display='inline';		
		
		var objWidth=objDiv.offsetWidth;
		var objHeight=objDiv.offsetHeight;
		if(maus[0]+objWidth-document.documentElement.scrollLeft > document.documentElement.clientWidth)//document.body.clientWidth
			maus[0]=maus[0]-objWidth;
		if(maus[1]+objHeight-document.documentElement.scrollTop > document.documentElement.clientHeight)//document.body.clientHeight
			maus[1]=maus[1]-objHeight;
			
		objDiv.style.top=maus[1]+'px';
		objDiv.style.left=maus[0]+'px';
			
		currPopup=objDiv;
	}
	else
	{
		objDiv.style.display='inline';
	}
}


function divPopupSubHide(objDiv)
{
	objDiv.style.display='none';
}
function divPopupSub(divId,pid)
{
	var objDiv=getObj(divId);
	objDiv.style.display='inline';
	var objWidth=objDiv.offsetWidth;
	var objHeight=objDiv.offsetHeight;
	
	var p_objDiv=getObj(pid);	
	var p_objWidth=p_objDiv.offsetWidth;
	var p_objHeight=p_objDiv.offsetHeight;
	var objLeft_=p_objWidth-5;
	var objTop_=p_objHeight-30;
	
	if(p_objDiv.offsetLeft+p_objWidth+objWidth-document.documentElement.scrollLeft > document.documentElement.clientWidth)
		objLeft_=5-objWidth;
	if(p_objDiv.offsetTop+p_objHeight+objHeight-document.documentElement.scrollTop > document.documentElement.clientHeight)
		objTop_=-objHeight+p_objHeight;
	
	objDiv.style.left=objLeft_+'px';
	objDiv.style.top=objTop_+'px';
}
			
function strtoint(str)
{
	if(str.indexOf(".")>1 && str.indexOf(",")<1)
	{
		if(str.length-str.indexOf(".")<=3 && str.indexOf(".")==str.lastIndexOf("."))
		{
			str=str.replace(".",",");	
		}
	}	
	str=str.replace(/[.]+/g,'');
	var i=parseFloat(str.replace(',','.'));
	return str=="" || str=="-" ? 0 : i;
}
function inttostr(i)
{			
	var str=i.toString().replace(/[.]+/g,',');
	return str;
}

function isInt(eingabe)
{
	var num_error = false;
	if(eingabe)
	{
		var eingabe_str = eingabe;
		var num = eingabe_str.match(/[^0-9,\.]/gi);
		var dot = eingabe_str.match(/\./g);
		var com = eingabe_str.match(/,/g);
		if (num!=null)
		{
			num_error = true;
		}
		else if ((dot!=null)&&(dot.length>1))
		{
			num_error = true;
		}
		else if ((com!=null)&&(com.length>1))
		{
			num_error = true;
		}
		else if ((com!=null)&&(dot!=null))
		{
			num_error = true;
		}
	}
	return !num_error;
}			

function int_only(feld)
{
	if(feld.value=="")
	{
		glob_error=true;
		return;
	}
	if(isNaN(feld.value.replace(".","")))
	{
		glob_error=true;
		alert("Bitte nur numerische Eingaben!");
		feld.select();
		feld.focus();
		return;
	}
	glob_error=false;
}

function num_only(feld)
{
	if(feld.value == "")
	{
		//glob_error=true;
		return;
	}
	if(glob_error)
	{
		//alert("Sie haben Fehler in den numerischen Feldern!");
		return;	
	}
	var v=feld.value.replace(/[.]+/g,'');
	if(!isInt(v))
	{
		glob_error=true;
		if(v.replace(',', '.').substr(v.length-1,v.length)!='.')
		{
			alert("Bitte nur numerische Eingaben!");
			feld.value=lastKnownFieldValue;
			glob_error=false;
			feld.select();
			feld.focus();
		}
		return;
	}
	if(v==feld.value)
	{
		lastKnownFieldValue=feld.value;
		glob_error=false;
	}
}

/*function number_format(zahl,decimal_num,dec_point,mill_sep) {
  var sign = '';
  if(zahl < 0) {sign = '-';}
  zahl = Math.abs(zahl);
  var divisor = 1;
  for(var i = 0; i < decimal_num; i++) {zahl *= 10; divisor *= 10;}
  zahl = Math.floor(zahl);
  var decimals= zahl % divisor;
  decimals = '' + decimals;
  for(var i = 0; i < decimal_num; i++) {zahl /= 10;}
  zahl = Math.floor(zahl);
  zahl = '' + zahl;
  zahl_grp = '';
  while(zahl.length > 3) {
    zahl_grp = mill_sep + zahl.substr(zahl.length-3,3) + zahl_grp;
    zahl = zahl.substr(0,zahl.length-3);
  }
  var str = zahl + zahl_grp;
  if(decimal_num > 0) {
    str = str + dec_point;
    while(decimals.length != decimal_num) {decimals= decimals+ '0';}
    str = str + decimals
  }
  return sign + str;
}*/

/*
function number_format(zahl, k, dec_point, mill_sep,fix)
{
	if(!k) k = 0;
	if(fix==null) fix = true;
	var neu = '';
	
	// Runden
	var f = Math.pow(10, k);
	zahl = '' + parseInt( zahl * f + (.5 * (zahl > 0 ? 1 : -1)) ) / f ;
	
	// Komma ermittlen
	var idx = zahl.indexOf('.');
	if(zahl.strpos("."= 
	
	// fehlende Nullen einfgen
	if(fix)
	{
		zahl += (idx == -1 ? '.' : '' )
		+ f.toString().substring(1);
	}
	
	// Nachkommastellen ermittlen
	idx = zahl.indexOf('.');
	if( idx == -1) idx = zahl.length;
	else neu = dec_point + zahl.substr(idx + 1, k);
	
	// Tausendertrennzeichen
	var zahl_=zahl.replace("-","");
	while(idx > 0)
	{
		if(idx - 3 > 0)
			neu = mill_sep + zahl.substring( idx - 3, idx) + neu;
		else
			neu = zahl.substring(0, idx) + neu;
		idx -= 3;
	}
	return neu; 
}*/

function number_format (number, decimals, dec_point, thousands_sep)
{
  var exponent = "";
  var numberstr = number.toString ();
  var eindex = numberstr.indexOf ("e");
  if (eindex > -1)
  {
    exponent = numberstr.substring (eindex);
    number = parseFloat (numberstr.substring (0, eindex));
  }
  
  if (decimals != null)
  {
    var temp = Math.pow (10, decimals);
    number = Math.round (number * temp) / temp;
  }
  var sign = number < 0 ? "-" : "";
  var integer = (number > 0 ? 
      Math.floor (number) : Math.abs (Math.ceil (number))).toString ();
  
  var fractional = number.toString ().substring (integer.length + sign.length);
  dec_point = dec_point != null ? dec_point : ".";
  fractional = decimals != null && decimals > 0 || fractional.length > 1 ? 
               (dec_point + fractional.substring (1)) : "";
  if (decimals != null && decimals > 0)
  {
    for (i = fractional.length - 1, z = decimals; i < z; ++i)
      fractional += "0";
  }
  
  thousands_sep = (thousands_sep != dec_point || fractional.length == 0) ? 
                  thousands_sep : null;
  if (thousands_sep != null && thousands_sep != "")
  {
	for (i = integer.length - 3; i > 0; i -= 3)
      integer = integer.substring (0 , i) + thousands_sep + integer.substring (i);
  }
  
  return sign + integer + fractional + exponent;
}

function strpos (haystack, needle, offset) {
    var i = (haystack+'').indexOf(needle, (offset || 0));
    return i === -1 ? false : i;
}
function formatNumber(obj,KommaStellen,force)
{
	if(glob_error)
	{
		//alert("Sie haben Fehler in den numerischen Feldern!");
		//obj.select();
		//obj.focus();
		return;
	}
	var value=obj.value;
	force=force!='undefined' ? force : true;
	if(value!="")
	{
		/*if(value.indexOf(".")<value.length-KommaStellen-1)
		{
			value=value.replace(".","");			
		}*/
		if(!force)
		{
			var v=value;
			//alert(v);
			if(v.indexOf(".")>1 && v.indexOf(",")<1)
			{
				if(v.length-v.indexOf(".")<=3 && v.indexOf(".")==v.lastIndexOf("."))
				{
					v=v.replace(".",",");	
				}
			}	
			v=v.replace(/[.]+/g,'');
			var KommaStellen_=v.length-strpos(v,',',0)-1;
			if(KommaStellen_<KommaStellen)
			{
				KommaStellen=KommaStellen_;					
			}
		}
		value=strtoint(value);
		obj.value=number_format(value.toFixed(KommaStellen),KommaStellen,',','.');//var v=
		/*if(!force)
		{
			last=v.substr(-1,1);
			while(last!='')
			{
				
			}
		}	
		obj.value=v;*/	
	}
}

function mausPos(e)
{
	var x=e.pageX || window.event.x+document.documentElement.scrollLeft;
	var y=e.pageY || window.event.y+document.documentElement.scrollTop;
	var size=new Array();
	size[0]=x;
	size[1]=y;
	return size;
}

function resizeWindow(x,y)
{
	if (navigator.appName == 'Microsoft Internet Explorer')
	{
		window.resizeTo(x+10,y+29);
	}
	else
	{
		if(navigator.appVersion.substring(0,1) < "5")
		{
			window.resizeTo(x,y);
		}
		else
		{
			window.resizeTo(x+8,y+28);
		}
	}
}

function addScreenRule(selector, declarations)
{
	// Kennt der Browser document.styleSheets und existiert bereits eines?
	if (!document.styleSheets || document.styleSheets.length == 0)
	{
		return false;
	}
	var stylesheet = document.styleSheets[0];
	if (stylesheet.insertRule)
	{
		new_rule_number = stylesheet.insertRule(selector + " { " + declarations + " }",
		stylesheet.cssRules.length);
		if (stylesheet.cssRules[new_rule_number].cssText.length > 0) {
			return true;
		}
	}
	else if (stylesheet.addRule)
	{
		// MSIE kennt addRule statt insertRule
		stylesheet.addRule(selector, declarations);
		return true;
	}
	// kein Erfolg
	return false;
}

function objPosTop(obj)
{
	var pos_ =0;
	if(typeof(obj.offsetLeft) != 'undefined')
	{
	   while (obj)
	   {
		   pos_ += obj.offsetTop;
		   obj = obj.offsetParent;
	   }
	}
	else
	{
	   pos_.top = obj.top ;
	}
	return pos_;
}

function objPosLeft(obj)
{
	var pos_ =0;
	if(typeof(obj.offsetLeft) != 'undefined')
	{
	   while (obj)
	   {
		   pos_ += obj.offsetLeft;
		   obj = obj.offsetParent;
	   }
	}
	else
	{
	   pos_.top = obj.left ;
	}
	return pos_;
}

/* [TABLE] */

function table_trIndexByObj(trObj)
{
	var table=trObj.parentNode.parentNode.id;
	objTable=document.getElementById(table);
	for(i=0;i<objTable.rows.length;i++)
	{
		if(objTable.rows[i].id==trObj.id)
		{
			return i;
		}
	}
	return -1;
}
function table_trIndexById(objTable,trId)
{
	for(i_tmp=0;i_tmp<objTable.rows.length;i_tmp++)
	{
		if(objTable.rows[i_tmp].id==trId)
		{
			return i_tmp;
		}
	}
	return -1;
}
function table_delTrByObj(trObj)
{
	var table=trObj.parentNode.parentNode;
	var trIndex=table_trIndexByObj(trObj);
	table.deleteRow(trIndex);
}
function table_delTrById(table,trIndex)
{
	var table=getObj(table);
	table.deleteRow(trIndex);
}
function table_addTr(tableId,trIndex,trObj)
{
	var table=getObj(tableId);
	//table.insertRow(trIndex);
	table.appendChild(trObj);
	alert("!");
	for(i=0;i<trObj.cells.length;i++)
	{
		//table.rows[trIndex].insertCell(i);
		//table.rows[trIndex].cells[i].innerHTML=tr.cells[i].innerHTML;
		table.rows[trIndex].appendChild(trObj.cells[i]);
	}
}
function table_addTrByArr(tableId,trIndex,ArrTr)
{
	var table=getObj(tableId);
	table.insertRow(trIndex);
	for(i=0;i<ArrTr.length;i++)
	{
		table.rows[trIndex].insertCell(i);			
		table.rows[trIndex].cells[i].innerHTML=ArrTr[i];
	}
}

/* [/TABLE] */


function showDivPopup(id,url,DontSetPos)
{
	getObj(id+"_pleaseWait").style.display="inline";
	getObj(id+"_frm").style.display="none";
	showContentBox(id,DontSetPos);
	eval(id+"_iframe").location.href=url;
	drgObjToFront(getObj(id));
}


/* [CHARTS] */

function deleteChart(cid)
{
	getObj("AddedCharts").removeChild(getObj("div_chart["+cid+"]"));
}

/* [/CHARTS] */

function selectIndexByValue(objSel,v)
{
	for(X=0;X<objSel.options.length;X++)
	{
		if(objSel.options[X].value==v)
		{
			return X;
		}
	}
	return -1;
}

function selectDropdownOption(element,value)
{
	for (var i_tmp=0; i_tmp<element.options.length; i_tmp++) 
	{
		if (element.options[i_tmp].value == value) 
		{
			element.options[i_tmp].selected = true;		
		}
		else
		{
			element.options[i_tmp].selected = false;	
		}
	}
}

function setRowState(obj,clsId)
{
	var classes=new Array();
	classes[0]="itemList";
	classes[1]="itemList_active";
	classes[2]="itemList_active2";
	classes[3]="itemList_inactive";
	obj.className=clsId!=null ? classes[clsId] : (obj.className==classes[0] ? classes[1] : classes[0]);
}

/* [TABS] */
var tab_groups=new Array();
var tabs=new Array();
var tab_indices=new Array();

function addTab(group,ind)
{
	if(tabs[group]==undefined)
	{
		tabs[group]=new Array();
		tab_groups[tab_groups.length]=group;
		tab_indices[group]=new Array();
	}
	ind=ind==undefined ? tabs[group].length : ind;
	tab_indices[group][tab_indices[group].length]=ind;
	tabs[group]
	[ind]=ind;
}

function showTab(id,group)
{
	var tabList=tabs[group];
	for(i=0;i<tab_indices[group].length;i++)
	{
		getObj(group+"_"+tab_indices[group][i]).className="";
		getObj(group+"_"+tab_indices[group][i]+"_content").className="tab_content";
	}
	getObj(group+"_"+id).className="active";
	getObj(group+"_"+id+"_content").className="tab_content_show";
}
/* [/TABS] */


/* [DYN_CONTENT] */
var dc_groups=new Array();
var dcs=new Array();
var dc_indices=new Array();

function addDc(group,ind)
{
	if(dcs[group]==undefined)
	{
		dcs[group]=new Array();
		dc_groups[dc_groups.length]=group;
		dc_indices[group]=new Array();
	}
	ind=ind==undefined ? dcs[group].length : ind;
	dc_indices[group][dc_indices[group].length]=ind;
	dcs[group]
	[ind]=ind;
}

function showDc(id,group,width)
{
	var dcList=dcs[group];
	for(i=0;i<dc_indices[group].length;i++)
	{
		getObj(group+"_"+dc_indices[group][i]).className="";
	}
	if(id!='')
	{
		msg(getObj(group+"_"+id+"_content").innerHTML,'',"showDc('','"+group+"');hidemsg()",'',width);
		getObj(group+"_"+id).className="active";
	}
}
/* [/DYN_CONTENT] */

function getAnker()
{	
	var url=document.URL;
	return url.indexOf("#")>0 ? url.substring(url.indexOf("#")+1) : "";
}

/* [MSG_BOX] */
function msg(text,title,btnOk,classname,bxWidth)
{
	btnOk=btnOk!=undefined ? btnOk : '';
	classname=classname!=undefined ? classname : '';
	bxWidth=bxWidth!=undefined ? bxWidth : '';
	
	if(getObj("swf_container")!=null)
	{
		getObj("swf_container").style.position="absolute";
		getObj("swf_container").style.top="-500px";
	}
	if(title!='')
	{
		text="<h1>"+title+"</h1>"+text;
	}
	if(classname!='')
	{
		getObj("modDivAlert").className=classname;
	}
	if(bxWidth!='')
	{
		bxWidth+=55;
		getObj("modDivAlert").style.width=bxWidth+"px";
		getObj("modDivAlert").style.marginLeft=((bxWidth/2)*-1)+"px";
		getObj("modDivAlert").style.left="50%";	
	}
	//<div style="float:right;"><a href="javascript:hidemsg();"><img src="/img/buttons/ico_close.png" alt="Fenster schlie�en" style="margin-right:0px;" /></a></div><br />
	getObj("modDivAlert_msg").innerHTML='<div class="modDivAlert_content">'+text+'</div>';
	//getObj("modDivAlert_msg").innerHTML=text;
	//getObj("modDivAlert").style.marginTop='-'+getObj("modDivAlert").style.height;
	getObj("modDivAlert_btn").innerHTML=(btnOk!='hide' ? '<input type="button" value="schliessen" class="btn_close" onclick="'+(btnOk!='' ? btnOk+';' : 'hidemsg();')+'" />' : '');
	
	//showbox("pageDarkener");
	//showbox("modDivAlert");
	getObj("pageDarkener").style.visibility="visible";
	getObj("modDivAlert").style.visibility="visible";
}
function hidemsg()
{
	getObj("modDivAlert_msg").innerHTML='';
	//hidebox("pageDarkener");
	//hidebox("modDivAlert");
	getObj("pageDarkener").style.visibility="hidden";
	getObj("modDivAlert").style.visibility="hidden";
	if(getObj("swf_container")!=null)
	{
		getObj("swf_container").style.position="";
		getObj("swf_container").style.top="0px";
	}
}
/* [/MSG_BOX] */


function getOS()
{
	var browser = navigator.userAgent;
	if (browser.indexOf("Win98") != -1 || browser.indexOf("Windows 98") != -1)
		os = "Microsoft Windows 98";
	else if (browser.indexOf("Win95") != -1 || browser.indexOf("Windows 95") != -1)
		os = "Microsoft Windows 95";
	else if (browser.indexOf("Win 9x 4.90") != -1)
		os = "Microsoft Windows ME";
	else if (browser.indexOf("WinNT 5.0") != -1 || browser.indexOf("Windows NT 5.0") != -1)
		os = "Microsoft Windows 2000";
	else if (browser.indexOf("WinNT 5.1") != -1 || browser.indexOf("Windows NT 5.1") != -1)
		os = "Microsoft Windows XP";
	else if (browser.indexOf("WinNT 5.2") != -1 || browser.indexOf("Windows NT 5.2") != -1)
		os = "Microsoft Windows Server 2003";
	else if (browser.indexOf("WinNT 6.0") != -1 || browser.indexOf("Windows NT 6.0") != -1)
		os = "Microsoft Windows Vista";
	else if (browser.indexOf("Linux") != -1)
	{
		if (browser.indexOf("Debian") != -1)
			os = "Linux Debian";
		else if (browser.indexOf("Ubuntu") != -1)
			os = "Linux Ubuntu";
		else if (browser.indexOf("Mandriva") != -1)
			os = "Linux Mandriva";
		else if (browser.indexOf("SUSE") != -1)
			os = "Linux SUSE";
		else
			os = "Linux";
	}
	else if (browser.indexOf("Unix") != -1)
		os = "Unix";
	else if (browser.indexOf("OS X") != -1)
		os = "Mac OS X";
	else if (browser.indexOf("OS/2") != -1)
		os = "OS/2";
	else if (browser.indexOf("SymbianOS") != -1)
		os = "Symbian OS";
	else if (browser.indexOf("FreeBSD") != -1)
		os = "FreeBSD";
	if (browser.indexOf("Media Center ") != -1)
		os = os + " (Media Center PC)";	
	return os;
}

function getBrowsername()
{
	var navName = navigator.appName ;
	var brVer = navigator.userAgent;
	var brNum;
	var reg = new RegExp('/');
	
	if (navigator.appName == 'Microsoft Internet Explorer')
	{
		brNum = brVer.substr(brVer.indexOf('MSIE'),8);
		brNum = brNum.substr(brNum.indexOf(' ')+1);
	}
	else if (navigator.appName == 'Netscape')
	{
		brNum = brVer.substr(brVer.indexOf('Netscape'),8);
		brNum = brNum.substr(brNum.indexOf(' ')+1);
	}
	else
	{
	   var brVerId = brVer.search(reg);
	   brNum = brVer.substring(brVerId+1);
	}
	return navName+" "+brNum;
}