// JavaScript Document

/* ------------  GENERAL  ------------ */
/* =================================== */
function opene_New_Doc( content ) {
	handle_New_Doc = window.open(content, 'NavigareVizitator', 'toolbar=yes, location=yes, directories=yes, status=yes, menubar=yes, resizable=yes, scrollbars=yes, width=720, height=560');
	handle_New_Doc.focus();
}// func
function redirect( address ){
	if( address.replace(/ /g, "").length == 0 ) return;
	window.location.href = address;
}
function searchCod( itemID, value ){  /*  filter action - when something is clicked */
	//SIC(itemID, value);
	//window.location.reload()
	redirect('produse.php?srch='+encodeURI(value));
}

/* -------------  INIT  -------------- */
/* =================================== */
function initRelImg(){
		var pagelinks = document.getElementsByTagName("a")
		for (var i=0; i<pagelinks.length; i++){ //BEGIN FOR LOOP
			if( pagelinks[i].getAttribute("rel") && (pagelinks[i].getAttribute("rel").substring(0, 4) == "afSpec") ){ //Begin if statement
				pagelinks[i].onclick = function() {
										numeFisier = this.href;
										numarFisier = numeFisier.substring(numeFisier.lastIndexOf(".")-2, numeFisier.lastIndexOf(".") );
										numeSerie = this.rel;
										numeSerie = numeSerie.substring( numeSerie.lastIndexOf(",")+1 );
										activare(numeSerie, numarFisier);
										return false;
										}
				} //end if statement
			} //END FOR LOOP
} //END initRel() function

/* -----------  NO MENU  ------------- */
/* =================================== */
var message = "Va invitam cu multa placere sa ne vizitati spatiile de prezentare."; 
function fara_meniu(keyp){
	return;
	if (navigator.appName == "Netscape" && keyp.which == 3){
		alert(message); 
		return false; 
		}
	else if (navigator.appVersion.indexOf("MSIE") != -1 && event.button == 2) {
		alert(message); 	
		return false; 
		}
	else {
		alert(message); 	
		return false; 
		}
	} 
//document.onmousedown = fara_meniu;
document.oncontextmenu = fara_meniu;

/* ----------- COOCKIES  ------------- */
/* =================================== */
function SIC( elemID, value ){  /* Save In Cookie */
	document.cookie = elemID + "=" + value +"; path=" +escape('/')  ;  //+"; domain='//localhost/develop/building/'"
//	alert(document.cookie);
}
function GFC( elemID ){  /* Get From Cookie */
	// get cookie value
	cookies = d.cookie.split(';');
	for(i=0; i<cookies.length; i++ ) {
		tmp = cookies[i].split('=');
		if(  tmp[0].replace(/ /g,'')==elemID ) return tmp[1];
		}
	return -1;
}

