

// browsercheck
var ns6 = document.getElementById && !document.all ? 1 : 0;
var ns4 = document.layers && !document.all ? 1 : 0;

var clipboardSwf = "/swf/clipboard.swf";


function copyToClipboard(label) {
	if(window.clipboardData != null || clipboardSwf != null) {
		//var code=dp.sh.Utils.FixForBlogger(highlighter.originalCode).replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&amp;/g,'&');
		var code = label; 
		
		if(window.clipboardData) {
			window.clipboardData.setData('text',code);
		} else if(clipboardSwf != null) {
			/*var flashcopier = highlighter.flashCopier;
			if(flashcopier == null) {
				flashcopier = document.createElement('div');
				highlighter.flashCopier = flashcopier;
				highlighter.div.appendChild(flashcopier);
			}*/
			
				var highlighter = ns6 ? document.getElementById("highlighter") : ns4 ? document.layers["highlighter"] : document.all["highlighter"];

			
				flashcopier = document.createElement('div');
				//highlighter.flashCopier = flashcopier;
				highlighter.appendChild(flashcopier);

			flashcopier.innerHTML = '<embed src="' + clipboardSwf + '" FlashVars="clipboard='+encodeURIComponent(code)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
		}
		alert('The code is in your clipboard now');
	}
}



function show_element() {
	var laenge = show_element.arguments.length;
	var args = show_element.arguments;
	var method = (args[0] == "display") ? "d" : "v";
	for (i = 1; i < laenge; i++) {
		var path = ns6 ? document.getElementById(args[i]).style : ns4 ? document.layers[args[i]] : document.all[args[i]].style;
		if(method == "d") {
			path.display = "block";
		} else {	
	    	path.visibility = "visible";
	    }	
	}
}

function hide_element() {
	var laenge = hide_element.arguments.length;
	var args = hide_element.arguments;
	var method = (args[0] == "display") ? "d" : "v";
	for (i = 1; i < laenge; i++) {
		var path = ns6 ? document.getElementById(args[i]).style : ns4 ? document.layers[args[i]] : document.all[args[i]].style;
		if(method == "d") {
			path.display = "none";
		} else {	
	    	path.visibility = "hidden";
	    }	
	}

}


function show_time(form,layer) {
	if(form.checked) {
		show_element("display",layer);
	} else {
		hide_element("display",layer);
	}
}





if (navigator.platform) {
	var isWIN = navigator.platform.indexOf ("Win") != -1;
	var isMAC = navigator.platform.indexOf ("Mac") != -1;
}
var isMSIE = navigator.appName.indexOf ("Microsoft") != -1;
var isNAVI = navigator.appName.indexOf ("Netscape") != -1;


var detect;
function infofenster_ein(text) {
	if(text) {
		inhalt = ''+text+'';
	
		if (document.all) {
			document.all.contextlayer.innerHTML= inhalt;
			detect = true;
			
		} else if (document.layers) {
			document.layers.contextlayer.document.write(inhalt);
			document.layers.contextlayer.document.close();
			document.captureEvents(Event.MOUSEMOVE);
			document.onmousemove = positionieren_ns;
		
		} else if (document.getElementById) {
			document.getElementById("contextlayer").innerHTML = inhalt;
			document.addEventListener("mousemove", positionieren, false);
		}
		show_element('visible','contextlayer');
	}
}





document.onmousemove = bewege;


function replaceHtml(containerLayer,text) {
	if(text) {
		inhalt = ''+text+'';
	
		if (document.all) {
			alert(inhalt)
			document.all.containerLayer.innerHTML= inhalt;
			
		} else if (document.layers) {
			document.layers.containerLayer.document.write(inhalt);
			document.layers.containerLayer.document.close();
		
		} else if (document.getElementById) {
			document.getElementById(containerLayer).innerHTML = inhalt;
		}
	}
}







//ie
function bewege() {
	if (document.all && detect == true) {
		document.all.contextlayer.style.left = window.event.clientX - 30;
		document.all.contextlayer.style.top = window.event.clientY + document.body.scrollTop + 20;
	}
}

//ns
function positionieren_ns(e) {
	document.layers.contextlayer.left = e.pageX;
	document.layers.contextlayer.top = e.pageY;
	//document.onmousemove = null; wenn aktiv, dann kein draggen
}

//mozilla
function positionieren(e) {
	document.getElementById("contextlayer").style.left = e.clientX -30;
	document.getElementById("contextlayer").style.top = e.clientY+20;
	//document.onmousemove = null; wenn aktiv, dann kein draggen
}





// open win functions
function win_calendar_insert_date(date) {
	window.open('/calendar/details.php?date=' + date,'','width=400,height=500,resizable=yes');
}

function win_calendar_date(id) {
	window.open('/calendar/details.php?id=' + id,'','width=400,height=500,resizable=yes');
}

function win_calendar_date_fixed(date_index,id) {
	window.open('/calendar/ical_details.php?date_index='+date_index+'&id='+id,'','width=400,height=300,resizable=yes');
}

function win_calendar_date_fixed_extern(date_index,id) {
	window.open('/calendar/ical_details_extern.php?date_index='+date_index+'&id='+id,'','width=400,height=300,resizable=yes');
}

function win_link(id) {
	var add = (id) ? "?id=" + id : "";			
	//window.open('/links/details_link.php' + add,'','width=350,height=300,resizable=yes');
	frame_details.location.href = '/links/details_link.php' + add;
}

function win_link_cat(id) {
	var add = (id) ? "?id=" + id : "";			
	//window.open('/links/details_cat.php' + add,'','width=400,height=300,resizable=yes');
	frame_details.location.href = '/links/details_cat.php' + add;
}

function win_note(id) {
	var add = (id) ? "?id=" + id : "";			
	window.open('/notes/details.php' + add,'','width=440,height=540,resizable=yes');
}

function win_todos(id) {
	var add = (id) ? "?id=" + id : "";			
	window.open('/todos/details.php' + add,'','width=440,height=600,resizable=yes');
}

function win_todos_project(id) {
	var add = (id) ? "?id=" + id : "";			
	window.open('/admin/projects.php' + add,'','width=440,height=600,resizable=yes');
}

function win_address(id) {
	var add = (id) ? "?id=" + id : "";			
	window.open('/addressbook/details.php' + add,'','width=440,height=540,resizable=yes');
}








function change_class(who,class_name) {
	who.className = class_name;
}



function swap_style_td_bg(who) {
	if(who.className == "calendardays") {
		who.className = "calendardayshighlight";
	} else {
		who.className = "calendardays";
	}
}

function swap_style_td_bg_today(who) {
	if(who.className == "today") {
		who.className = "todayhighlight";
	} else {
		who.className = "today";
	}
}

/*

function toggle_display(layer_name) {
	var path = ns6 ? document.getElementById(layer_name).style : ns4 ? document.layers[layer_name] : document.all[layer_name].style;
	if(path.display == "none") {
		path.display = "block";
	} else {	
		path.display = "none";
	}	
}
*/

function toggle_display() {
	var laenge = toggle_display.arguments.length;
	var args = toggle_display.arguments;
	for (i = 0; i < laenge; i++) {
		var path = ns6 ? document.getElementById(args[i]).style : ns4 ? document.layers[args[i]] : document.all[args[i]].style;
		if(path.display == "") {
			path.display = "none";
		} else {	
	    	path.display = "";
	    }	
	}
}

function toggle_display_expand() {
	var img_name = toggle_display_expand.arguments[0];
	var laenge = toggle_display_expand.arguments.length;
	var args = toggle_display_expand.arguments;
	for (i = 1; i < laenge; i++) {
		var path = ns6 ? document.getElementById(args[i]).style : ns4 ? document.layers[args[i]] : document.all[args[i]].style;
		if(path.display == "") {
			path.display = "none";
			document[img_name].src = icon_plus.src;
		} else {	
	    	path.display = "";
			document[img_name].src = icon_minus.src;
	    }	
	}
}




/*
ajax functions
*/
function ajax(layer,filename,getvarname,getvarvalue) {
	var xmlHttp = null;
	// Mozilla, Opera, Safari sowie Internet Explorer 7
	if (typeof XMLHttpRequest != 'undefined') {
		xmlHttp = new XMLHttpRequest();
	}
	if (!xmlHttp) {
		// Internet Explorer 6 und Šlter
		try {
			xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				xmlHttp  = null;
			}
		}
	}
	if (xmlHttp) {
//		xmlHttp.open('GET', filename + '?' + getvarname + '=' + getvarvalue, true);
		xmlHttp.open('POST', filename, true);
		xmlHttp.onreadystatechange = function () {
			if (xmlHttp.readyState == 4) {
				replace_inner_html(layer,xmlHttp.responseText);
			}
		};
		xmlHttp.send(null);
	}
}

/*
ajax functions
*/
function ajax_get_array(layer,filename,arr_get) {
	var xmlHttp = null;
	var params = "";
	// Mozilla, Opera, Safari sowie Internet Explorer 7
	if (typeof XMLHttpRequest != 'undefined') {
		xmlHttp = new XMLHttpRequest();
	}
	if (!xmlHttp) {
		// Internet Explorer 6 und Šlter
		try {
			xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				xmlHttp  = null;
			}
		}
	}
	if (xmlHttp) {
		
		for(key in arr_get) {
			params += key + "=" + arr_get[key] + "&";
		}
	
		xmlHttp.open('GET', filename + '?' + params, true);
		xmlHttp.onreadystatechange = function () {
			if (xmlHttp.readyState == 4) {
				replace_inner_html(layer,xmlHttp.responseText);
			}
		};
		xmlHttp.send(null);
	}
}


/*
*	ersetzt html in einem element
*/
function replace_inner_html(layer, text) {
	var detect, content;
	
	content = ''+text+'';

	if (document.all) {
		document.all[layer].innerHTML= content;
		detect = true;
		
	} else if (document.layers) {
		document.layers[layer].document.write(content);
		document.layers[layer].document.close();	
	} else if (document.getElementById) {
		document.getElementById(layer).innerHTML = content;
	}
}

/*
*	@layer	name of div to replace content
*	@filename	name of file to call
*	@getvarname	variable name
*	@getvarvalue	variable value
*/
function show_ajax(layer,filename,getVarName,getVarValue) {
	replace_inner_html(layer,"<img src='/images/indicator_arrows.gif' alt='loading' width='16' height='16' style='margin:10px'>");
	ajax(layer, filename, getVarName, getVarValue);
}





var arr_country = new Array();
arr_country[''] = "- Country -";
arr_country['AD'] = "Andorra";
arr_country['AE'] = "United Arab Emirates";
arr_country['AF'] = "Afghanistan";
arr_country['AG'] = "Antigua and Barbuda";
arr_country['AI'] = "Anguilla";
arr_country['AL'] = "Albania";
arr_country['AM'] = "Armenia";
arr_country['AN'] = "Netherlands Antilles";
arr_country['AO'] = "Angola";
arr_country['AQ'] = "Antarctica";
arr_country['AR'] = "Argentina";
arr_country['AS'] = "American Samoa";
arr_country['AU'] = "Austria";
arr_country['AS'] = "Australia";
arr_country['AW'] = "Aruba";
arr_country['AZ'] = "Azerbaijan";
arr_country['BA'] = "Bosnia and Herzegovina";
arr_country['BB'] = "Barbados";
arr_country['BD'] = "Bangladesh";
arr_country['BE'] = "Belgium";
arr_country['BF'] = "Burkina Faso";
arr_country['BH'] = "Bahrain";
arr_country['BI'] = "Burundi";
arr_country['BJ'] = "Benin";
arr_country['BM'] = "Bermuda";
arr_country['BO'] = "Bolivia";
arr_country['BR'] = "Brazil";
arr_country['BS'] = "Bahamas";
arr_country['BT'] = "Bhutan";
arr_country['BU'] = "Bouvet Island";
arr_country['BV'] = "Bulgaria";
arr_country['BW'] = "Botswana";
arr_country['BX'] = "Brunei Darussalam";
arr_country['BY'] = "Belarus";
arr_country['BZ'] = "Belize";
arr_country['CA'] = "Canada";
arr_country['CC'] = "Cocos (Keeling) Islands";
arr_country['CF'] = "Central African Republic";
arr_country['CG'] = "Congo";
arr_country['CH'] = "Switzerland";
arr_country['CI'] = "Cote D'Ivoire (Ivory Coast)";
arr_country['CK'] = "Cook Islands";
arr_country['CL'] = "Chile";
arr_country['CM'] = "Cameroon";
arr_country['CN'] = "China";
arr_country['CO'] = "Colombia";
arr_country['CR'] = "Costa Rica";
arr_country['CU'] = "Cuba";
arr_country['CV'] = "Cape Verde";
arr_country['CX'] = "Christmas Island";
arr_country['CY'] = "Cyprus";
arr_country['CZ'] = "Czech Republic";
arr_country['DE'] = "Germany";
arr_country['DJ'] = "Djibouti";
arr_country['DK'] = "Denmark";
arr_country['DM'] = "Dominica";
arr_country['DO'] = "Dominican Republic";
arr_country['DZ'] = "Algeria";
arr_country['EC'] = "Ecuador";
arr_country['EE'] = "Estonia";
arr_country['EG'] = "Egypt";
arr_country['EH'] = "Western Sahara";
arr_country['ER'] = "Eritrea";
arr_country['ES'] = "Spain";
arr_country['ET'] = "Ethiopia";
arr_country['FI'] = "Finland";
arr_country['FJ'] = "Fiji";
arr_country['FK'] = "Falkland Islands (Malvinas)";
arr_country['FM'] = "Micronesia";
arr_country['FO'] = "Faroe Islands";
arr_country['FR'] = "France";
arr_country['GA'] = "Gabon";
arr_country['GB'] = "Great Britain (UK)";
arr_country['GD'] = "Grenada";
arr_country['GE'] = "Georgia";
arr_country['GF'] = "French Guiana";
arr_country['GH'] = "Ghana";
arr_country['GI'] = "Gibraltar";
arr_country['GL'] = "Greenland";
arr_country['GM'] = "Gambia";
arr_country['GN'] = "Guinea";
arr_country['GP'] = "Guadeloupe";
arr_country['GQ'] = "Equatorial Guinea";
arr_country['GR'] = "Greece";
arr_country['GS'] = "South Georgia and South Sandwich Islands";
arr_country['GT'] = "Guatemala";
arr_country['GU'] = "Guam";
arr_country['GW'] = "Guinea-Bissau";
arr_country['GY'] = "Guyana";
arr_country['HK'] = "Hong Kong";
arr_country['HM'] = "Heard and McDonald Islands";
arr_country['HN'] = "Honduras";
arr_country['HR'] = "Croatia and Hrvatska";
arr_country['HT'] = "Haiti";
arr_country['HU'] = "Hungary";
arr_country['ID'] = "Indonesia";
arr_country['IE'] = "Ireland";
arr_country['IL'] = "Israel";
arr_country['IN'] = "India";
arr_country['IO'] = "British Indian Ocean Territory";
arr_country['IQ'] = "Iraq";
arr_country['IR'] = "Iran";
arr_country['IS'] = "Iceland";
arr_country['IT'] = "Italy";
arr_country['JM'] = "Jamaica";
arr_country['JO'] = "Jordan";
arr_country['JP'] = "Japan";
arr_country['KE'] = "Kenya";
arr_country['KG'] = "Kyrgyzstan";
arr_country['KH'] = "Cambodia";
arr_country['KI'] = "Kiribati";
arr_country['KM'] = "Comoros";
arr_country['KN'] = "Saint Kitts and Nevis";
arr_country['KP'] = "Korea North";
arr_country['KR'] = "Korea South";
arr_country['KW'] = "Kuwait";
arr_country['KY'] = "Cayman Islands";
arr_country['KZ'] = "Kazakhstan";
arr_country['LA'] = "Laos";
arr_country['LB'] = "Lebanon";
arr_country['LC'] = "Saint Lucia";
arr_country['LI'] = "Liechtenstein";
arr_country['LK'] = "Sri Lanka";
arr_country['LR'] = "Liberia";
arr_country['LS'] = "Lesotho";
arr_country['LT'] = "Lithuania";
arr_country['LU'] = "Luxembourg";
arr_country['LV'] = "Latvia";
arr_country['LY'] = "Libya";
arr_country['MA'] = "Morocco";
arr_country['MC'] = "Monaco";
arr_country['MD'] = "Moldova";
arr_country['MG'] = "Madagascar";
arr_country['MH'] = "Marshall Islands";
arr_country['MK'] = "Macedonia";
arr_country['ML'] = "Mali";
arr_country['MM'] = "Myanmar";
arr_country['MN'] = "Mongolia";
arr_country['MO'] = "Macau";
arr_country['MP'] = "Northern Mariana Islands";
arr_country['MQ'] = "Martinique";
arr_country['MR'] = "Mauritania";
arr_country['MS'] = "Montserrat";
arr_country['MT'] = "Malta";
arr_country['MU'] = "Mauritius";
arr_country['MV'] = "Maldives";
arr_country['MW'] = "Malawi";
arr_country['MX'] = "Mexico";
arr_country['MY'] = "Malaysia";
arr_country['MZ'] = "Mozambique";
arr_country['NA'] = "Namibia";
arr_country['NC'] = "New Caledonia";
arr_country['NE'] = "Niger";
arr_country['NF'] = "Norfolk Island";
arr_country['NG'] = "Nigeria";
arr_country['NI'] = "Nicaragua";
arr_country['NE'] = "Netherlands";
arr_country['NO'] = "Norway";
arr_country['NP'] = "Nepal";
arr_country['NR'] = "Nauru";
arr_country['NU'] = "Niue";
arr_country['NZ'] = "New Zealand";
arr_country['OM'] = "Oman";
arr_country['PA'] = "Panama";
arr_country['PE'] = "Peru";
arr_country['PF'] = "French Polynesia";
arr_country['PG'] = "Papua New Guinea";
arr_country['PH'] = "Philippines";
arr_country['PK'] = "Pakistan";
arr_country['PO'] = "Poland";
arr_country['PM'] = "St. Pierre and Miquelon";
arr_country['PN'] = "Pitcairn";
arr_country['PR'] = "Puerto Rico";
arr_country['PT'] = "Portugal";
arr_country['PW'] = "Palau";
arr_country['PY'] = "Paraguay";
arr_country['QA'] = "Qatar";
arr_country['RE'] = "Reunion";
arr_country['RO'] = "Romania";
arr_country['RU'] = "Russian Federation";
arr_country['RW'] = "Rwanda";
arr_country['SA'] = "Saudi Arabia";
arr_country['SB'] = "Solomon Islands";
arr_country['SC'] = "Seychelles";
arr_country['SD'] = "Sudan";
arr_country['SE'] = "Sweden";
arr_country['SG'] = "Singapore";
arr_country['SH'] = "St. Helena";
arr_country['SI'] = "Slovenia";
arr_country['SJ'] = "Svalbard and Jan Mayen Islands";
arr_country['SK'] = "Slovak Republic";
arr_country['SL'] = "Sierra Leone";
arr_country['SM'] = "San Marino";
arr_country['SN'] = "Senegal";
arr_country['SO'] = "Somalia";
arr_country['SR'] = "Suriname";
arr_country['ST'] = "Sao Tome and Principe";
arr_country['SV'] = "El Salvador";
arr_country['SY'] = "Syria";
arr_country['SZ'] = "Swaziland";
arr_country['TC'] = "Turks and Caicos Islands";
arr_country['TD'] = "Chad";
arr_country['TF'] = "French Southern Territories";
arr_country['TG'] = "Togo";
arr_country['TH'] = "Thailand";
arr_country['TI'] = "Tajikistan";
arr_country['TK'] = "Tokelau";
arr_country['TM'] = "Turkmenistan";
arr_country['TN'] = "Tunisia";
arr_country['TO'] = "Tonga";
arr_country['TP'] = "East Timor";
arr_country['TR'] = "Turkey";
arr_country['TT'] = "Trinidad and Tobago";
arr_country['TV'] = "Tuvalu";
arr_country['TW'] = "Taiwan";
arr_country['TZ'] = "Tanzania";
arr_country['UA'] = "Ukraine";
arr_country['UG'] = "Uganda";
arr_country['UK'] = "United Kingdom";
arr_country['UM'] = "US Minor Outlying Islands";
arr_country['US'] = "United States of America (USA)";
arr_country['UY'] = "Uruguay";
arr_country['UZ'] = "Uzbekistan";
arr_country['VA'] = "Vatican City State";
arr_country['VC'] = "Saint Vincent and the Grenadines";
arr_country['VE'] = "Venezuela";
arr_country['VG'] = "Virgin Islands (British)";
arr_country['VN'] = "Viet Nam";
arr_country['VU'] = "Vanuatu";
arr_country['WF'] = "Wallis and Futuna Islands";
arr_country['WS'] = "Samoa";
arr_country['YE'] = "Yemen";
arr_country['YT'] = "Mayotte";
arr_country['YU'] = "Yugoslavia";
arr_country['ZA'] = "South Africa";
arr_country['ZM'] = "Zambia";
arr_country['ZR'] = "Zaire";
arr_country['ZW'] = "Zimbabwe";

