var wndDragX=0;//sw//
var wndDragY=0;//sw//
function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_type = new XMLHttpRequest();
}
return request_type;
}

function moreContent(id1,id2)
{
	document.getElementById(id1).style.display="block";
	document.getElementById(id2).style.display="none";
	return false;
}

var http = createObject();

wndmousemove=function(e){
	e=e||window.event;
	if(wndDragX!=0 && document.getElementById('ajax_window')!=null){
		document.getElementById('ajax_window').style.left=e.clientX-wndDragX+'px';
		document.getElementById('ajax_window').style.top=e.clientY-wndDragY+'px';
	}
}

function intercom_changeCountrey(id){
	http.open('get','templates/default/intercom/ajax.php?id='+id);
	http.onreadystatechange = function(){
		if(http.readyState == 4){
			document.getElementById('intercom_vid_div').innerHTML=http.responseText;
		}
	}
	http.send(null);
}
function contact_ajChangeCity(id){
	http.open('get','templates/default/contacts/ajax.php?id='+id);
	http.onreadystatechange = function(){
		if(http.readyState == 4){
			document.getElementById('contact_div_inner').innerHTML=http.responseText;
		}
	}
	http.send(null);
}
function show_miniwindow(){
win_tsk=window.open ('modules/intercom/show_price.php', 'mywindow','width=600, height=500,status=no,scrollbars=yes,toolbar=no,menubar=no');
win_tsk.focus ();
}

function change_sel_tab(lst_id,tp){
	if(tp==0){clsnm='rt-tab-no-selected';}else{clsnm='rt-tab-selected';}
	clsnm_l=clsnm+'-left';
	clsnm_m=clsnm+'-center';
	clsnm_r=clsnm+'-right';
	document.getElementById('tabs_title_left'+lst_id).className=clsnm_l;
	document.getElementById('tabs_title_mid'+lst_id).className=clsnm_m;
	document.getElementById('tabs_title_right'+lst_id).className=clsnm_r;
	document.getElementById('tabs_title_full'+lst_id).className=clsnm;
}
function showHideDiv(id){
obj=document.getElementById(id);
if(obj.style.display!='block'){obj.style.display='block'}else{obj.style.display='none';}
}
function clearAndDis(name){
	obj=document.getElementsByName(name)[0];
	obj.value='';
	obj.disabled=true;
}
function change_chbx(el){
	if(el.checked){
		switch (el.name) {
			case 'chbx_tabs':
				document.getElementsByName('chbx_redbox')[0].checked=false;
				clearAndDis('fredbox_title');
				clearAndDis('fredbox_link');
			break
			case 'chbx_redbox':
				document.getElementsByName('chbx_tabs')[0].checked=false;
				document.getElementsByName('fredbox_title')[0].disabled=false;
				document.getElementsByName('fredbox_link')[0].disabled=false;
			break
			case 'chbx_undertabs':
				document.getElementsByName('fundertabs_title')[0].disabled=false;
				document.getElementsByName('fundertabs_link')[0].disabled=false;
			break
		}
	}else{
		switch (el.name) {
			case 'chbx_redbox':
				clearAndDis('fredbox_title');
				clearAndDis('fredbox_link');
			break
			case 'chbx_undertabs':
				clearAndDis('fundertabs_title');
				clearAndDis('fundertabs_link');
			break
		}
	}
}

function del_message(s)
  {
    if (confirm("Вы действительно хотите удалить запись?"))
	  {
	    location.href=s;
	  }
  }
  
function incalls () {
	var cal1, mCal, mDCal, newStyleSheet;

	var dateFrom = null;
	var dateTo = null;

	window.onload = function () {
		cal1 = new dhtmlxCalendarObject('calInput1');
		cal1.setSkin("classic");
	}
}
var opswin;
var top_=10;
var left_=10;
function tops(w,h){
	if(navigator.appName == "Netscape") {
		top_=window.innerHeight/2-h/2;
		left_=window.innerWidth/2-w/2;
	}
	else{
		top_=document.body.clientHeight/2-h/2;
		left_=document.body.clientWidth/2-w/2;
	}
	if(top_<0)top=0;
	if(left_<0)top=0;
}
function adm_opwin(a,w,h){
	if (navigator.userAgent.toLowerCase().indexOf("opera")==-1 && opswin!=null && !opswin.closed)opswin.close();
	tops(w,h);
	opswin=window.open(a,'',"height="+h+",width="+w+",status=no,toolbar=no,menubar=no,location=no,top="+top_+",left="+left_+",scrollbars=yes,resizable=yes");
	opswin.focus();
}


