var browser = navigator.appName;

if (browser=="Microsoft Internet Explorer") {

	var html_doc = document.getElementsByTagName('head').item(0);

	var js = document.createElement('script');

	js.setAttribute('language', 'javascript');

	js.setAttribute('type', 'text/javascript');

	html_doc.appendChild(js);

}

function emoticon(text, unde) {if (unde.text_insert.createTextRange && unde.text_insert.caretPos) {var caretPos = unde.text_insert.caretPos;caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;unde.text_insert.focus();} else { unde.text_insert.value  += text;unde.text_insert.focus();}return false;}

function checkall_in(frm) {for (var i=0;i<frm.elements.length;i++){var e=frm.elements[i];if ((e.name != 'allbox') && (e.className != 'nocheck') && (e.type=='checkbox')){e.checked=frm.allbox.checked;}}}

function setimage (newimg,description,h,w) {

	document.images['mainimg'].src = newimg.replace("n_","");

	document.images['mainimg'].width = w;

	/* document.images['mainimg'].height = h; */

	document.getElementById('main_img_href').href = newimg.replace("n_","");

}

function mareste(){file=document.images['mainimg'].src;h=document.images['mainimg'].height;w=document.images['mainimg'].width;}

function deschide_privat(n) {window.open('im.php?to='+n,n,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=250,height=150');return false;}

function inchide_mesaj(id) {sendReq('im.php', 'citit', id);var x = document.getElementById(id); x.style.display='none';return false;}



var http = createRequestObject();

var objectId = '';

function createRequestObject(htmlObjectId){var obj;var browser = navigator.appName;objectId = htmlObjectId;if(browser == "Microsoft Internet Explorer"){obj = new ActiveXObject("Microsoft.XMLHTTP");}else{obj = new XMLHttpRequest();}return obj;}

function sendReq(serverFileName, variableNames, variableValues) {var paramString = '';variableNames = variableNames.split(',');variableValues = variableValues.split(',');for(i=0; i<variableNames.length; i++) {paramString += variableNames[i]+'='+variableValues[i]+'&';}paramString = paramString.substring(0, (paramString.length-1));if (paramString.length == 0) {http.open('get', serverFileName);}else{http.open('get', serverFileName+'?'+paramString);}http.onreadystatechange = handleResponse;http.send(null);}

function handleResponse() {if(http.readyState == 4){responseText = http.responseText;if (objectId) document.getElementById(objectId).innerHTML = responseText;}}



/**

 * SWFObject v1.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/

 *

 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:

 * http://www.opensource.org/licenses/mit-license.php

 *

 * **SWFObject is the SWF embed script formarly known as FlashObject. The name was changed for

 *   legal reasons.

 */

if(typeof deconcept == "undefined") var deconcept = new Object();

if(typeof deconcept.util == "undefined") deconcept.util = new Object();

if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();

deconcept.SWFObject = function(swf, id, w, h, ver, c, useExpressInstall, quality, xiRedirectUrl, redirectUrl, detectKey){

	if (!document.createElement || !document.getElementById) { return; }

	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';

	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);

	this.params = new Object();

	this.variables = new Object();

	this.attributes = new Array();

	if(swf) { this.setAttribute('swf', swf); }

	if(id) { this.setAttribute('id', id); }

	if(w) { this.setAttribute('width', w); }

	if(h) { this.setAttribute('height', h); }

	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }

	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion(this.getAttribute('version'), useExpressInstall);

	if(c) { this.addParam('bgcolor', c); }

	var q = quality ? quality : 'high';

	this.addParam('quality', q);

	this.addParam('wmode', 'transparent');

	this.setAttribute('useExpressInstall', useExpressInstall);

	this.setAttribute('doExpressInstall', false);

	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;

	this.setAttribute('xiRedirectUrl', xir);

	this.setAttribute('redirectUrl', '');

	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }

}

deconcept.SWFObject.prototype = {

	setAttribute: function(name, value){

		this.attributes[name] = value;

	},

	getAttribute: function(name){

		return this.attributes[name];

	},

	addParam: function(name, value){

		this.params[name] = value;

	},

	getParams: function(){

		return this.params;

	},

	addVariable: function(name, value){

		this.variables[name] = value;

	},

	getVariable: function(name){

		return this.variables[name];

	},

	getVariables: function(){

		return this.variables;

	},

	getVariablePairs: function(){

		var variablePairs = new Array();

		var key;

		var variables = this.getVariables();

		for(key in variables){

			variablePairs.push(key +"="+ variables[key]);

		}

		return variablePairs;

	},

	getSWFHTML: function() {

		var swfNode = "";

		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture

			if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "PlugIn");

			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';

			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';

			var params = this.getParams();

			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }

			var pairs = this.getVariablePairs().join("&");

			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }

			swfNode += '/>';

		} else { // PC IE

			if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "ActiveX");

			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';

			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';

			var params = this.getParams();

			for(var key in params) {

			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';

			}

			var pairs = this.getVariablePairs().join("&");

			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}

			swfNode += "</object>";

		}

		return swfNode;

	},

	write: function(elementId){

		if(this.getAttribute('useExpressInstall')) {

			// check to see if we need to do an express install

			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);

			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {

				this.setAttribute('doExpressInstall', true);

				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));

				document.title = document.title.slice(0, 47) + " - Flash Player Installation";

				this.addVariable("MMdoctitle", document.title);

			}

		}

		if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){

			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;

			n.innerHTML = this.getSWFHTML();

			return true;

		}else{

			if(this.getAttribute('redirectUrl') != "") {

				document.location.replace(this.getAttribute('redirectUrl'));

			}

		}

		return false;

	}

}



/* ---- detection functions ---- */

deconcept.SWFObjectUtil.getPlayerVersion = function(reqVer, xiInstall){

	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);

	if(navigator.plugins && navigator.mimeTypes.length){

		var x = navigator.plugins["Shockwave Flash"];

		if(x && x.description) {

			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));

		}

	}else{

		try{

			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");

			for (var i=3; axo!=null; i++) {

				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);

				PlayerVersion = new deconcept.PlayerVersion([i,0,0]);

			}

		}catch(e){}

		if (reqVer && PlayerVersion.major > reqVer.major) return PlayerVersion; // version is ok, skip minor detection

		// this only does the minor rev lookup if the user's major version 

		// is not 6 or we are checking for a specific minor or revision number

		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/

		if (!reqVer || ((reqVer.minor != 0 || reqVer.rev != 0) && PlayerVersion.major == reqVer.major) || PlayerVersion.major != 6 || xiInstall) {

			try{

				PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));

			}catch(e){}

		}

	}

	return PlayerVersion;

}

deconcept.PlayerVersion = function(arrVersion){

	this.major = parseInt(arrVersion[0]) != null ? parseInt(arrVersion[0]) : 0;

	this.minor = parseInt(arrVersion[1]) || 0;

	this.rev = parseInt(arrVersion[2]) || 0;

}

deconcept.PlayerVersion.prototype.versionIsValid = function(fv){

	if(this.major < fv.major) return false;

	if(this.major > fv.major) return true;

	if(this.minor < fv.minor) return false;

	if(this.minor > fv.minor) return true;

	if(this.rev < fv.rev) return false;

	return true;

}

/* ---- get value of query string param ---- */

deconcept.util = {

	getRequestParameter: function(param){

		var q = document.location.search || document.location.hash;

		if(q){

			var startIndex = q.indexOf(param +"=");

			var endIndex = (q.indexOf("&", startIndex) > -1) ? q.indexOf("&", startIndex) : q.length;

			if (q.length > 1 && startIndex > -1) {

				return q.substring(q.indexOf("=", startIndex)+1, endIndex);

			}

		}

		return "";

	}

}



/* add Array.push if needed (ie5) */

if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}



/* add some aliases for ease of use/backwards compatibility */

var getQueryParamValue = deconcept.util.getRequestParameter;

var FlashObject = deconcept.SWFObject; // for legacy support

var SWFObject = deconcept.SWFObject;



var timp_refresh_default = 10;var timp_refresh = timp_refresh_default;

function do_refresh() { var browser = navigator.appName;if(browser == "Microsoft Internet Explorer"){y = document.getElementById('anIframe');if (y.document.getElementById('trimite_chat')){y.document.getElementById('trimite_chat').value='2';document.getElementById('anIframe').submit();}else {anIframe.mainchat.trimite_chat.value = '2';anIframe.mainchat.submit();}} else {y = window.anIframe;y.document.mainchat.trimite_chat.value = '2';y.document.mainchat.submit();}timp_refresh=timp_refresh_default;}



function timer(unde) {if (timp_refresh>=1) timp_refresh = timp_refresh-1;else {do_refresh();} x = document.getElementById(unde);x.innerHTML = 'Chat Box - <span style="font-size:9px;">refresh automat in '+ timp_refresh + ' sec &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><a href="javascript:do_refresh();">Refresh acum</a> '; {window.setTimeout("timer('"+unde+"')",1000);}}

function focus_pe(unde) {var browser = navigator.appName;if(browser == "Microsoft Internet Explorer") {if (document.getElementById(unde))document.forms.mainchat.text_insert.focus();}else {if (document.getElementById(unde))document.forms.mainchat.text_insert.focus();}}

function show_hide(care) {var carex=document.getElementById(care);if (carex.style.display=='none') carex.style.display='block';else carex.style.display='none';return false;}

function show(care) { var carex=document.getElementById(care); carex.style.display='block';	return false; }

function hide(care) { var carex=document.getElementById(care); carex.style.display='none'; return false; }

var is_gecko = /gecko/i.test(navigator.userAgent);

var is_ie    = /MSIE/.test(navigator.userAgent);

function setSelectionRange(input, start, end) {if (is_gecko) {input.setSelectionRange(start, end);input.focus();} else {var range = input.createTextRange();range.collapse(true);range.moveStart("character", end);range.moveEnd("character", 0);input.focus();range.select();}};

function textLimit(field, maxlen) {if (field.value.length > maxlen) field.value = field.value.substring(0, maxlen);}

function sbt(x) {document.getElementById('vot').value = x;document.getElementById('fx').submit();}

function verifica_same(unde, cu_ce) {if (unde.value==cu_ce) unde.value = '';}

function verifica_adaugare_articol(unde) {if (document.forms.add_articol.info.value == '' || document.forms.add_articol.info.value == default_info_articol) {alert('Completeaza titlul !');document.forms.add_articol.info.focus();return false;}if (document.forms.add_articol.tags.value == '' || document.forms.add_articol.tags.value == default_tags_articol) {alert('Completeaza taguri (cel putin unul) !');document.forms.add_articol.tags.focus();return false;}return true;}

var ESCAPED = 1;var UNESCAPED = 2;var txtSubscribe = 'Quick:';var q_hdrfont = 'Verdana';var q_hdrsize = '1';var q_hdrcolor = '#FFFFFF';var q_bgcolor = '#006699';var q_contentfont = 'Verdana';var q_contentsize = '1';var q_contentbgcolor = '#EEEEEE';var q_frame = self;var over = null;var oTimer; var ns4 = (navigator.appName == 'Netscape' && parseInt(navigator.appVersion) == 4);var ns6 = (document.getElementById)? true:false;var ie4 = (document.all)? true:false; if (ie4) { var docRoot = 'document.body'; } if (ns4) {var oW = window.innerWidth;var oH = window.innerHeight; window.onresize = function () {if (oW!=window.innerWidth||oH!=window.innerHeight) location.reload();}}if (ie4) {if ((navigator.userAgent.indexOf('MSIE 5') > 0) || (navigator.userAgent.indexOf('MSIE 6') > 0)) {if(document.compatMode && document.compatMode == 'CSS1Compat') { docRoot = 'document.documentElement';}} if (ns6) {ns6 = false;}}

function quicksub(oLink, utilizator,puncte,sex,oras,an_nastere,cale_user,imgfile) {

	if (oTimer) {

		clearTimeout(oTimer);

		}

	var originalUrl = '';

	var url = escape(originalUrl);

	var text = ''; 

	text = '';

	text = text + '<div><ul class=\"\">';

	if (sex=='0') text = text +'<li class="li3 blue">'+utilizator+'</li>';

	else text = text +'<li class="li3 blue">'+utilizator+'</li>';

	text = text + '<li>'+(2008-an_nastere)+' ani</li>';

	text = text +'<li class=li2>'+puncte+' puncte</li>';

	if (sex=='0') text = text +'<li class="li3 blue">fata</li>';

	else text = text +'<li class="li3 blue">baiat</li>';

	text = text +'<li class=li4>'+oras+'</li>';

	text = text +'<img src=\"'+cale_site+'templates/images/18.gif\" id="loaderx" border=0 />'; 

	text = text +'<li><a href="'+cale_user+'" id="main_img_href"><img onload="hide(\'loaderx\');" src="' +cale_users_v+ 'images/n_'+ imgfile +'" width=\"150\" border="0"></a></li>'; 

	text = text +'</ul></div>'; 

	if ( (ns4) || (ie4) || (ns6) ) {

		q_frame = self;  

		if (ns4) over = q_frame.document.quickSub; 

		if (ie4) over = q_frame.quickSub.style; 

		if (ns6) over = q_frame.document.getElementById("quickSub");} 

		if(!ns4) { 

		var layerhtml = '<div class=\'qsheader\'>' + txtSubscribe + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF=\"javascript:return closeqs();\" onMouseOver=\"return closeqs();\">[<b>x</b>]</A></div><div class=\'qscontent\'>' + text + '</div>'; } 

		else {

			var closing = "<TD ALIGN=RIGHT><A HREF=\"javascript:return closeqs();\" onMouseOver=\"return closeqs();\"><FONT COLOR=\""+q_hdrcolor+"\" FACE=\""+q_hdrfont+"\" SIZE=\""+q_hdrsize+"\">[<b>xxx</b>]</FONT></A></TD>";

			var layerhtml = "<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BGCOLOR=\'"+q_bgcolor+"\'><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><B><FONT COLOR=\""+q_hdrcolor+"\" FACE=\""+q_hdrfont+"\" SIZE=\""+q_hdrsize+"\">" + txtSubscribe + "</FONT></B></TD>"+closing+"</TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\'"+ q_contentbgcolor + "\'\"><TR><TD VALIGN=TOP><FONT FACE=\""+q_contentfont+"\" SIZE=\""+q_contentsize+"\">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>";

			}

			layerWrite(layerhtml);

			placeLayer(oLink);

			showObject(over);

			return true;

			}

	var posx = 0;

	var posy = 0;



function closeqs() {if (over != null) hideObject(over);return true;}

function placeLayer(oLink) {

	document.onmousemove = doSomething;

	var placeX, placeY, iOffset, aPosition;

	aPosition = findPosition(oLink);

	placeX = eval(aPosition[0]) + 20; 

	placeY = eval(aPosition[1]) + 10; 

	if ( (ns4) || (ie4) ) {

		over.left = (ie4 ? placeX + 'px' : placeX); 

		over.top = (ie4 ? placeY + 'px' : placeY);} 

		else if (ns6) {

			over.style.left = placeX + "px"; 

			over.style.top = placeY + "px";}}

function layerWrite(txt) {if (ns4) {var lyr = q_frame.document.quickSub.document;lyr.write(txt);lyr.close();} else if (ie4) {q_frame.document.all["quickSub"].innerHTML = txt;} else if (ns6) {range = q_frame.document.createRange();range.setStartBefore(over);domfrag = range.createContextualFragment(txt);while (over.hasChildNodes()) {over.removeChild(over.lastChild);}over.appendChild(domfrag); }}

function showObject(obj) {if (ns4) obj.visibility = "show";else if (ie4) obj.visibility = "visible";else if (ns6) obj.style.visibility = "visible";}

function hideObject(obj) {if (ns4) obj.visibility = "hide";else if (ie4) obj.visibility = "hidden";else if (ns6) obj.style.visibility = "hidden";}



function findPosition (oLink) {



/*

	if (oLink.offsetParent) {

		for (var iPosX = 0, iPosY = 0; 

			 oLink.offsetParent; 

			 oLink = oLink.offsetParent) {

				iPosX += oLink.offsetLeft;

				iPosY += oLink.offsetTop;

//				alert(iPosX);

			}

		return [iPosX, iPosY];} else {return [oLink.x, oLink.y];}

*/



//doSomething(null);



return [posx, posy];

}



function doSomething(e) {

	if (!e) var e = window.event;

	if (e.pageX || e.pageY) 	{

		posx = e.pageX;

		posy = e.pageY;

	}

	else if (e.clientX || e.clientY) 	{

		posx = e.clientX + document.body.scrollLeft

			+ document.documentElement.scrollLeft;

		posy = e.clientY + document.body.scrollTop

			+ document.documentElement.scrollTop;

	}

	// posx and posy contain the mouse position relative to the document

	// Do something with this information

}





function timeqs () {if(!ns4) {var iDelay = 500;if (oTimer) {clearTimeout(oTimer);}if ((ns4 && over.visibility != 'hide') || (ie4 && over.visibility != 'hidden') ||(ns6 && over.style.visibility != 'hidden')) {oTimer = setTimeout(hideqs, iDelay);}}}

function hideqs () {if (oTimer) {clearTimeout(oTimer);}closeqs();}

function delayqs () {if (oTimer) {clearTimeout(oTimer);}}  





function limitare(camptextarea, camptext, maxim) {

 if (document.getElementById(camptextarea).value.length > maxim) { document.getElementById(camptextarea).value=document.getElementById(camptextarea).value.substring(0,maxim); }

 document.getElementById(camptext).value=document.getElementById(camptextarea).value.length; }





function trim(stringToTrim) {

	return stringToTrim.replace(/^\s+|\s+$/g,"");

}

function ltrim(stringToTrim) {

	return stringToTrim.replace(/^\s+/,"");

}

function rtrim(stringToTrim) {

	return stringToTrim.replace(/\s+$/,"");

}



function verifica_inretrebare(where) {

if (trim(where.info.value) == '') {

	alert('Completeaza intrebarea!');

	where.info.focus();

	return false;

}



if (trim(where.text_articol.value) == '') {

	alert('Pune cateva cuvinte despre intrebare!');

	where.text_articol.focus();

	return false;

}

return true;

}



function inchide_notificare(id) {

	sendReq('notificare.php', 'citit', id);

	var x = document.getElementById(id); 

	x.style.display='none';return false;

}



function deschide_scoala_inscr(n) {window.open('colegi_inscriere.php?inscriere='+n,n,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=250,height=150');return false;}

function deschide(url) {

//	alert(url);

	window.location.href = url;

	return false;

}

function arata_la_profil(ce) {

	document.getElementById('intrebari').style.display = 'none';

	document.getElementById('articole').style.display = 'none';

	document.getElementById('comentarii').style.display = 'none';

	document.getElementById('zona_descriere_profil').style.display = 'none';

	document.getElementById('profil_2').style.display = 'none';

	document.getElementById('zona_profil').style.display = 'none';

	document.getElementById('colegi').style.display = 'none';

	document.getElementById('ce_caut').style.display = 'none';

	document.getElementById('profil_avansat').style.display = 'none';





if (ce=='profil') {

		document.getElementById('zona_descriere_profil').style.display = 'block';

		document.getElementById('profil_2').style.display = 'block';

		document.getElementById('comentarii').style.display = 'block';		

	document.getElementById('zona_profil').style.display = 'block';

} else if (ce=='colegi') {

		document.getElementById('colegi').style.display = 'block';

} else if (ce=='articole') {

		document.getElementById('articole').style.display = 'block';

} else if (ce=='intrebari') {

		document.getElementById('intrebari').style.display = 'block';

} else if (ce=='ce_caut') {

		document.getElementById('ce_caut').style.display = 'block';

} else if (ce=='profil_avansat') {

		document.getElementById('profil_avansat').style.display = 'block';

}

		



return false;	

	

}



function get_tara(care) {

	objectId = 'judet';

	sendReq('tari_ajax.php', 'id_tara', care);

}
