	function OpenWindow(sUrl,sWndName,nWidth,nHeight){

		var wnd = open( sUrl , sWndName, "scrollbars=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,top=200,2eft=100,width=600,height=600");
		if(sUrl == ''){
			wnd.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
			wnd.document.write('<html xmlns="http://www.w3.org/1999/xhtml">');
			wnd.document.write('<head id="head">');
				wnd.document.write('<title>'+sWndName+'</title>');
				wnd.document.write('<meta http-equiv="Content-Type" content="text/html;windows-1251" />');
				wnd.document.write('<link rel="stylesheet" type="text/css" href="popup.css" />');
			wnd.document.write('</head>');
			wnd.document.write('<body>');
			// ...
			wnd.document.write('</body>');
			wnd.document.write('</html>');
		}
		document.onclick = function(){
			wnd.focus();
		};
		wnd.focus();
		return wnd;
	}
	
	function MM_openBrWindow(theURL,winName,features) { 
	  window.open(theURL,winName,features);
	}
	
	
	function MM_findObj(n, d) { //v4.0
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && document.getElementById) x=document.getElementById(n); return x;
	}
	
	//
	// Preview handling
	//  
	function previewDescription( sFrameName, sText )
	{	
		window.frames[ sFrameName ].document.clear();
		window.frames[ sFrameName ].document.write( '<html><body><table width="100%"><tr><td><pre style="font-family: arial,tahoma,verdana;">' + sText + '</pre></td></tr></table></body></html>' );
		window.frames[ "divDescriptionPreview" ].document.close();	
	}
	
	function previewPicture( sImageTagID, sImageFile ){
		$obj = document.getElementById(sImageTagID);
		$obj.src = sImageFile;
	}
	
	var checkflag = "false";
	function checking(field) {
		if (checkflag == "false") {
		for (i = 0; i < field.length; i++) {
			field[i].checked = true;}
			checkflag = "true";
			return "<?=$asRes[ 'DESELECTALL' ]?>"; 
		}else {
			for (i = 0; i < field.length; i++) {
			field[i].checked = false; }
			checkflag = "false";
			return "<?=$asRes[ 'SELECTALL' ]?>"; 
		}
	}
	
	function ValidateDelete(form){
		txt=form.action.options[form.action.selectedIndex].value
		option=txt
		if (option=="Delete"){
			if ( confirm( "<?=$asRes[ 'SURE_DELETE' ]?>" ) ) {return true;} else {return false;}
			return false;
		}else{
			return true;
		}
	}
	//Menu for translation
	
	var cm=null;
	document.onclick = new Function("show(null)")
	function getPos(el,sProp) {
		var iPos = 0
		while (el!=null) {
			iPos+=el["offset" + sProp]
			el = el.offsetParent
		}
		return iPos
	
	}
	
	function show(el,m) {
		if (m) {
			m.style.display='';
			m.style.pixelLeft = getPos(el,"Left")
			m.style.pixelTop = getPos(el,"Top") + el.offsetHeight-2
		}
		if ((m!=cm) && (cm)) cm.style.display='none'
		cm=m
	}
	
	function hide(el,m) {
		if (m) {
			m.style.display='none';
		}
		if ((m!=cm) && (cm)) cm.style.display='none'
		cm=m
	}
	
	function validateForm(frm,messege){
		var element = '';
		var error = false;
		var colorError = "1px solid #FF0000";
		var numelements = frm.elements.length;
		for(var i=0;i<numelements;i++){
			element = frm.elements[i];		
			if(element.className == 'on'){
				if(element.type == "checkbox" && element.checked == false){
					error = true;
					element.style.border = colorError;
				}
				if((element.type == 'text' || element.type == 'select-one' || element.type == 'textarea' || element.type == "password") && (element.value == "" || element.value == 0)){
					error = true;
					element.style.border = colorError;
				}
			}
		}
		if(error == true){
			alert(messege);
			return false;
		}else{
			return true;
		}
	}

	function openelement(elname){
		var obj = document.getElementById(elname);
		//if(obj.innerHTML) alert("This letter is empty!");
		if(obj.style.display != 'block'){
			obj.style.display = 'block';
		}else{
			obj.style.display = 'none';
		}
	}
	// activen grafick buttons //
	function activbutton(btn,act){
		var $src = btn.src;
		if(act){
			var spl = $src.split(".");
			spl[0] += "_on"; 
			btn.src = spl.join(".");
		}else{
			btn.src = $src.replace("_on","");
		}
	}
	// all checed box on form //
	function published(frm){
		var piblished = true;
		if(frm.ch.value == 1){
			piblished = false;
			frm.ch.value = 0;
		}else{
			var piblished = true;
			frm.ch.value = 1;
		}
		for(var i=0;i<frm.elements.length;i++){	
			if(frm.elements[i].type == "checkbox") frm.elements[i].checked = piblished;
		}
	}
	
	// redirect admin panel //
	function admin($path){
		document.onkeydown=function keyC(e){
			if(!ie){
				startLocation = e.which;
			}else{
				startLocation = event.keyCode;
			}
			if(startLocation == 113){
				window.location = $path;
			}
		}
	}

function cleanlocation(){
	var regexp = /www/;
	var locat = window.location+" ";
	if(regexp.test(window.location) != false) 
		window.location = locat.replace("www.","");
}
function addnumber(obj,messege){
	str = obj.value;
	obj.value = '';
	for(var i=0;i<str.length;i++){
		if(str.charAt(i) < "0" || str.charAt(i) > "9") {
			alert("("+str.charAt(i)+") "+messege);
			obj.style.border = '1px solid #FF0000';
			obj.select();
			return false;
		}
		obj.value += str.charAt(i);
	}
	return true;
}
//objcontextmenu

function showmsg(value,objId){
	
		document.getElementById(objId).style.display=value;	

		/*	
		var texts=new Array();
		texts['home']="<center><img src='/i/delicious3.jpg'>";
		texts['contacts']="<div class='titl'></div><br><table><tr align='left'><td class='txto'>Head Office</td><td class='txto'>&nbsp; &nbsp; </td><td class='txto'>Office London</td></tr><tr align='left' valign='bottom'><td class='txt'>35, Chumerna Str.<br>1202 Sofia, Bulgaria<br>phone: +359 2 983 6542<br>e-mail: <a href='mailto:web@studioitti.com' class='txt'>web@studioitti.com</a><br></td><td>&nbsp;</td><td class='txt'>114, Cromwell Rd<br>London SW5 9PP<br/>30 Nevern Place<br/>phone: +44 207 373 0218<br/>e-mail: <a href='mailto:DZahariev@studioitti.com' class='txt'>DZahariev@studioitti.com</a></td></tr></table>";
		texts['vision']="<div class='titl'>Vision</div><br><p class='txt'>Art is an Art for it is unique.<br>You can win if you are unique.<br>To be unique you have to be Art.<br><p class='txt' align=left>We believe that choosing and implementing the right new technologies in any Internet<br />endeavour is an Art for which we have the best talent and years of experience.<p class='txt' align=left>ITTI sees its clients as individuals and strives to deliver a balance<br />of specific need and technology.<p class='txt' align=left>Many companies will supply all the latest technologies,<br >but we will deliver the supreme solution for your business.<br /><p class='txt'>You have the case we have the solution!";
		texts['services']="<div class='titl'>Services</div><br><div class='txt' align=left>Here goes our recipe for delicious web solutions:<p>&nbsp; <span class=txto>Step 1.</span> Defining together your goal (Presentation, Database Integration, E-commerce, B2B).<br><p>&nbsp; <span class=txto>Step 2.</span> Creating your image on the Word Wide Web.<br><p>&nbsp; <span class=txto>Step 3.</span> Examining the optimum functionality for 100% usability.<br><p>&nbsp; <span class=txto>Step 4.</span> Combining the outcomes of steps two and three into your future site.<br><p>&nbsp; <span class=txto>Step 5.</span> Helping you to chouse and registering the right name for yours new site in .com, .net, .org, .biz or .info zone.<br><p>&nbsp; <span class=txto>Step 6.</span> Serving your appetising site on the back bone internet servers, with 24x7 support, by high trained professionals<br><br><p class='txto'>&nbsp;Bon Appetit :-)";
		document.getElementById('header_text_content').innerHTML=texts[page];
		document.getElementById('header_text_content').className='header_text_content';
		*/

	}
	

function checkIsRead(isRead,objId){
	//alert(isRead);
  
  var xmlhttp=false; 
  try {
    xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // За Firefox
  } catch (e) {
    try {
      xmlhttp = new
      ActiveXObject('Microsoft.XMLHTTP'); // За IE
    } catch (E) {
      xmlhttp = false;
    }
  }
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest(); 
  }
  var url = "isread.php?isRead=" + isRead; 
  xmlhttp.open('GET', url, true); 
  
  xmlhttp.onreadystatechange=function() { 
    if (xmlhttp.readyState==4) {
      var content = xmlhttp.responseText; 
      //var content ="1"; 
      
      if( content ){
      	//alert("content: " + content);
      	if( content == 1 ){
      		document.getElementById(objId).style.color='#666666;';
      	} else if( content == 2 ){
      		//alert('is 2');
      	}else{
      		//alert('is not 1 or 2 is ' + content);
      	}
        
      }
      
    }
  }
  
  xmlhttp.send(null) // Зануляване на XMLHttpRequest
  return;
}
	
function redirect(url){
	document.location.href=url;
}
	





current = 1;
function ap(text) {
	document.slideform.slidebutton.value = (text == "Stop") ? "Start" : "Stop";
	rotate();
}
function change() {
	current = document.slideform.slide.selectedIndex;
	document.images.show.src = document.slideform.slide[current].value;
}
function rotate() {
	if (document.slideform.slidebutton.value == "Stop") {
		current = (current == document.slideform.slide.length-1) ? 0 : current+1;
		document.images.show.src = document.slideform.slide[current].value;
		document.slideform.slide.selectedIndex = current;
		var option = document.slideform.slide.options[current];
		var delay = option.getAttribute('delay');
		window.setTimeout("rotate()", delay*1000);
	   }
}
function rotatee() {
	
		current = (current == document.slideform.slide.length-1) ? 0 : current+1;
		document.images.show.src = document.slideform.slide[current].value;
		document.slideform.slide.selectedIndex = current;
		var option = document.slideform.slide.options[current];
		var delay = option.getAttribute('delay');
		window.setTimeout("rotate()", delay*1000);
	   
}




