//Get XMLHTTP for IE or Mozilla
function getXmlHTTP(){
	if(typeof XMLHttpRequest!="undefined"){
		return new XMLHttpRequest();
	}
	else if(typeof ActiveXObject != "undefined")
	{
		try{
			var xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			return xmlhttp;
		}
		catch(e)
		{
			return null;
		}
	}
	return null;
}

//Cancel any current request.
function CancelCurrentRequest(){
	if(xmlReq!=null)xmlReq.abort();
}

function changeRate(sValue, id){
	document.getElementById("divRate_"+id).innerHTML = sValue;
}

function advert_change(formitem) {

	var Url = sURL+"web/default/template/advert/select.php";
	var ActUrl = Url + '?action=category&value='+document.getElementById('cat_id').value;

	if (formitem=='category') {
		xmlReq1=getXmlHTTP();
		xmlReq1.open("GET", ActUrl, true);
		xmlReq1.onreadystatechange=function(){
			if(xmlReq1.readyState==4){
				var xmlDoc1 = xmlReq1.responseText
				document.getElementById("type_id").innerHTML = xmlDoc1;
			}
		}
		xmlReq1.send(null);
	}
}

function menuform_change(formitem) {

	var Url = sURL+"web/default/template/menu/select.php";

	if (formitem=='select_1') {

		document.getElementById('link').value = document.getElementById('select_1').value + '/';

		xmlReq1=getXmlHTTP();
		xmlReq1.open("GET", Url + '?h=1&select_1='+document.getElementById('select_1').value, true);
		xmlReq1.onreadystatechange=function(){
			if(xmlReq1.readyState==4){
				var xmlDoc1 = xmlReq1.responseText
				if (document.getElementById('select_1').value==0) xmlDoc1 = '<option value="">---</option>';
				if(xmlDoc1!=null){
					document.getElementById("select_2").innerHTML = xmlDoc1;
					document.getElementById("select_3").innerHTML = '<option value="">---</option>';
				}
			}
		}
		xmlReq1.send(null);
	}

	if (formitem=='select_2') {

		document.getElementById('link').value = document.getElementById('select_1').value + '/' + document.getElementById('select_2').value + '/';

		xmlReq2=getXmlHTTP();
		xmlReq2.open("GET", Url + '?select_1='+document.getElementById('select_1').value+'&select_2='+document.getElementById('select_2').value, true);
		xmlReq2.onreadystatechange=function(){
			if(xmlReq2.readyState==4){
				var xmlDoc2 = xmlReq2.responseText
				if(xmlDoc2!=null){
					document.getElementById("select_3").innerHTML = xmlDoc2;
				}
			}
		}
		xmlReq2.send(null);
	}

	if (formitem=='select_3') {
		document.getElementById('link').value = document.getElementById('select_1').value + '/' + document.getElementById('select_2').value + '/' + document.getElementById('select_3').value;
	}

}

function doPoolRate(pool_data_id) {

	xmlReq=getXmlHTTP();
	var Url = sURL+"web/default/template/pools/pool.php";
	Url = Url + "?pool_data_id=" + pool_data_id;
	xmlReq.open("GET", Url, true);
	xmlReq.onreadystatechange=function(){
		if(xmlReq.readyState==4){
			var xmlDoc = xmlReq.responseText
			if(xmlDoc!=null){
				document.getElementById("pool").innerHTML = xmlDoc;
			}
		}
	}
	xmlReq.send(null);
}
function doPoolRateView(pool_id,pool_data_id,module_id,item_id) {

	xmlReq=getXmlHTTP();
	var Url = sURL+"web/default/template/pools/pool_view.php";
	Url = Url + "?pool_id=" +pool_id+"&pool_data_id=" + pool_data_id +"&module_id="+module_id+"&item_id="+item_id;
	xmlReq.open("GET", Url, true);
	xmlReq.onreadystatechange=function(){
		if(xmlReq.readyState==4){
			var xmlDoc = xmlReq.responseText
			if(xmlDoc!=null){
				document.getElementById("pool_"+pool_id).innerHTML = xmlDoc;
			}
		}
	}
	xmlReq.send(null);
}

function doRate(sValue, module_id, item_id){
	xmlReq=getXmlHTTP();
	//var Url = document.URL;
	var Url = sURL + "web/default/template/ranks/rank.php";
	Url = Url + "?rate=" + sValue + "&moduleid=" + module_id  + "&itemid=" + item_id;
	//alert('Url: '+Url);
	xmlReq.open("GET", Url, true);
	//Hook up the asynch handler.
	xmlReq.onreadystatechange=function(){
		if(xmlReq.readyState==4) {
			var xmlDoc = xmlReq.responseText
			//alert(xmlDoc);
			if(xmlDoc!=null){
				if (xmlDoc.indexOf("error:") == -1){
					var sRate = xmlDoc.split(";");
					document.getElementById("tdRating_"+module_id+"_"+item_id).innerHTML = sRate[0];
					document.getElementById("tdCount_"+module_id+"_"+item_id).innerHTML = sRate[1];
					document.getElementById("lirating_"+module_id+"_"+item_id).style.width = sRate[2] + "px";
				}
				else {
					document.getElementById("divRate_"+module_id+"_"+item_id).innerHTML = xmlDoc.replace("error:", "");
				}
			}
			else
			{

			}
		}
	}
	//Send the request.
	xmlReq.send(null);
}

function generateUrl(sValue, sArticle){
	xmlReq=getXmlHTTP();
	//var Url = document.URL;
	var Url = sURL + "web/default/template/content/generate_url.php";
	Url = Url + "?url=" + sValue + "&article=" + sArticle;
	xmlReq.open("GET", Url, true);
	//Hook up the asynch handler.
	xmlReq.onreadystatechange=function(){
		if(xmlReq.readyState==4){
			var xmlDoc = xmlReq.responseText
			//alert(xmlDoc);
			if(xmlDoc!=null){
				document.getElementById("url").value = xmlDoc;
			}
		}
	}
	//Send the request.
	xmlReq.send(null);
}

// product_id - # id 
// action  - del_all, del, change, add
// quantity - quantity of product
// session_id
// basket_type - small, big, count

function changeBasket(product_id, action, quantity, param, session_id, basket_type,ext){
	xmlReq1=getXmlHTTP();
	xmlReq2=getXmlHTTP();
	xmlReq3=getXmlHTTP();
	//var Url = document.URL;
	var Url = sURL + "web/default/template/shop/change_basket.php";
	var Urlmain = sURL + "web/default/template/shop/change_basket.php";
	Url = Url + "?product_id=" + product_id + "&action=" + action + "&quantity=" + quantity + "&session_id=" + session_id + "&basket_type=" + basket_type;
	Url+="&ext="+ext;
	if (param!=null) {
		if (action=='del') {
			param_vals = param;
			Url = Url + "&param=" + param_vals;

		} else if (action=='del_all') {
			////HERE IS NOTHING AND THAT IS CORRECT
		} else if (action=='change') {
			param_vals = param;
			Url = Url + "&param=" + param_vals;
		} else {
			if (param=='-') {
				Url = Url + "&param=";
			} else {
				params = param.split(',');
				param_vals = '';
				for (var i = 0; i < params.length; ++i) {
		 			selectedItem = document.form_shop_view['data_prodoption_' + params[i]];
					for (var a = 0; a < selectedItem.length; ++a) {
						if(selectedItem[a].checked) {
							if (param_vals == '') {
								param_vals = selectedItem[a].value;
							} else {
								param_vals = param_vals + ',' + selectedItem[a].value;
							}
						}
					}
				}
				Url = Url + "&param=" + param_vals;
			}
		}
	}

	xmlReq2.open("GET", Url, true);
	//Hook up the asynch handler.
	xmlReq2.onreadystatechange=function(){
		if(xmlReq2.readyState==4){
			var xmlDoc = xmlReq2.responseText
			//alert(xmlDoc);
			if(xmlDoc!=null){
				document.getElementById(basket_type+"_basket").innerHTML = xmlDoc;
			}
		}
	}
	
	//Send the request.
	xmlReq2.send(null);
	
    if ((document.getElementById('count_basket') != null) && (basket_type != 'count')) {

    var url2 = Urlmain + "?session_id=" + session_id + "&basket_type=count&ext="+ext;
    
    xmlReq3.open("GET", url2, true);
	//Hook up the asynch handler.
	xmlReq3.onreadystatechange=function(){
		if(xmlReq3.readyState==4){
			var xmlDoc = xmlReq3.responseText
			//alert(xmlDoc);
			if(xmlDoc!=null){
				document.getElementById("count_basket").innerHTML = xmlDoc;
			}
		}
	}
		xmlReq3.send(null);
}
	
	// big basket 
	/*xmlReq1.open("GET", Url + "&id=big", true);
	//Hook up the asynch handler.
	xmlReq1.onreadystatechange=function(){
		if(xmlReq1.readyState==4){
			var xmlDoc = xmlReq1.responseText
			//alert(xmlDoc);
			if(xmlDoc!=null){
				document.getElementById("big_basket").innerHTML = xmlDoc;
			}
		}
	}
	//Send the request.
	xmlReq1.send(null);*/
}

function changeFavour(product_id, action){
	xmlReq1=getXmlHTTP();
	xmlReq2=getXmlHTTP();
	//var Url = document.URL;
	var Url = sURL + "web/default/template/shop/change_favour.php";
	Url = Url + "?product_id=" + product_id + "&action=" + action;

	xmlReq1.open("GET", Url, true);
	xmlReq1.onreadystatechange=function(){
		if(xmlReq1.readyState==4){
			var xmlDoc = xmlReq1.responseText
			//alert(xmlDoc);
			if(xmlDoc!=null){
				document.getElementById("my_favour").innerHTML = xmlDoc;
			}
		}
	}
	xmlReq1.send(null);

}

function FavourCheck(item_id, module_id){
	xmlReq1=getXmlHTTP();
	//var Url = document.URL;
	var Url = sURL + "web/default/module/addtofavourites/favourcheck.php";
	Url = Url + "?item_id=" + item_id + "&module_id=" + module_id;

	xmlReq1.open("GET", Url, true);
	xmlReq1.onreadystatechange=function(){
		if(xmlReq1.readyState==4){
			var xmlDoc = xmlReq1.responseText;
			//alert(xmlDoc);
			if(xmlDoc!=null && get_element("my_favour_" + item_id) != null){
			  var obj = get_element("my_favour_" + item_id);
			  obj.innerHTML = xmlDoc;
			}
		}
		FavourView();
	}
	xmlReq1.send(null);
}

function FavourView () {
	xmlReq2=getXmlHTTP();
	var Url = sURL + "web/default/module/addtofavourites/favourview.php";
	xmlReq2.open("GET", Url, true)
	xmlReq2.onreadystatechange=function(){
		if(xmlReq2.readyState==4){
			var xmlDoc = xmlReq2.responseText;
			//alert(xmlDoc);
			if(xmlDoc!=null && get_element('my_favour_list') != null){
			  var obj = get_element('my_favour_list');
			  obj.innerHTML = xmlDoc;
			}
		}
	}
	xmlReq2.send(null);
}
function SaveDNDtable(table,ordering,playlist){
	xmlReq1=getXmlHTTP();
	xmlReq2=getXmlHTTP();
	//var Url = document.URL;
	var Url = sURL + "web/default/module/playlists/save_ordering.php";
	Url = Url + "?ordering=" + ordering + "&playlist_id=" + playlist;

	xmlReq1.open("GET", Url, true);
	xmlReq1.onreadystatechange=function(){
		if(xmlReq1.readyState==4){
			var xmlDoc = xmlReq1.responseText
			//alert(xmlDoc);
			if(xmlDoc!=null){

			}
		}
	}
	xmlReq1.send(null);
}
function PLS_rem_item(table_id,id,playlist,row){
	xmlReq1=getXmlHTTP();
	xmlReq2=getXmlHTTP();
	//var Url = document.URL;
	var Url = sURL + "web/default/module/playlists/remove_item.php";
	Url = Url + "?item_id=" + id + "&playlist_id=" + playlist;

	xmlReq1.open("GET", Url, true);
	xmlReq1.onreadystatechange=function(){
		if(xmlReq1.readyState==4){
			var xmlDoc = xmlReq1.responseText
			//alert(xmlDoc);
			if(xmlDoc!=null){
				if (xmlDoc == 'error')
				{ document.getElementById("rem_"+id).innerHTML = xmlDoc; }
				else{
				  deleteRow(table_id,row);
				}
			}
		}
	}
	xmlReq1.send(null);
}

function AddToPlaylist(item_id, playlist_id){
	var combo = document.getElementById("PlaylistComboFrame");
	var playlist_id = combo.options[combo.selectedIndex].value;
	document.getElementById("AddToPlaylistResponse").innerHTML = "";
	xmlReq1=getXmlHTTP();
	var Url = sURL + "web/default/module/playlists/addtoplaylist.php";
	Url = Url + "?item_id=" + item_id + "&playlist_id=" + playlist_id;
	xmlReq1.open("GET", Url, true);
	xmlReq1.onreadystatechange=function(){
			if(xmlReq1.readyState==4){
			var xmlDoc = xmlReq1.responseText;
			var data_array = new Array();
			data_array = xmlDoc.split("|");
			document.getElementById("AddToPlaylistResponse").innerHTML = data_array[0];
			if (data_array[1] == 'saved'){
			  document.getElementById("AddToPlaylistFrame").style.display = "none";
			}else{
			  document.getElementById("AddToPlaylistResponse").style.color = "red";
			}
		}
	}
	xmlReq1.send(null);
}

function GetSelectedPlaylistComboValue(item){
	var combo = document.getElementById("PlaylistComboFrame");

	AddToPlaylist(item, combo.options[combo.selectedIndex].value);
}

function CreateThumbnail(file_id,id_image){
    xmlReq1=getXmlHTTP();
    if (time.length < 1){ alert('ZLY CAS!'); }
    var Url = sURL + "web/default/module/myvideo/createthumbnail.php";
    Url = Url + "?item_id=" + file_id + "&time=" + time;

    xmlReq1.open("GET", Url, true);
    document.getElementById("thumbnail_response").innerHTML="Generating...";
    xmlReq1.onreadystatechange=function(){
        if(xmlReq1.readyState==4 ){
            var xmlDoc = xmlReq1.responseText
            //alert(xmlDoc);
            if(xmlDoc!=null){
                //Start();
                //document.images["img_thumbnail"].src= document.images ["img_thumbnail"].src;
                tmp = new Date();
                tmp = "?"+tmp.getTime();
                //var image = document.images["img_thumbnail"].src;
                var image = document.getElementById(id_image).src;
                document.images[id_image].src = image+tmp;
                document.getElementById("thumbnail_response").innerHTML="Ok...";
            }
        }


    }
    xmlReq1.send(null);
}

function CheckUserExists(nick,min_length,element_id){
	var Url = sURL+"web/default/module/users/check_exists.php";
	Url = Url + "?username=" + nick + "&minlength=" + min_length;
	
    if (nick.length < 4){			
	   document.getElementById(element_id).style.background='red';
	   document.getElementById('short_username').style.display = 'block';  
    }
    else{
	    xmlReq1=getXmlHTTP();
	    xmlReq2=getXmlHTTP();		
		xmlReq1.open("GET", Url, true);
		xmlReq1.onreadystatechange=function(){
			if(xmlReq1.readyState==4){
				var xmlDoc = xmlReq1.responseText
				//alert(xmlDoc);
				if(xmlDoc=='1'){
			       document.getElementById(element_id).style.background='green';
			       document.getElementById('user_message').style.display = 'none';
			       document.getElementById('short_username').style.display = 'none';
				}
				else{
				   document.getElementById(element_id).style.background='red';
				   document.getElementById('user_message').style.display = 'block';
				}			
			}
		}
		xmlReq1.send(null);	
	}
}

function CheckEmailExists(email,element_id){
	xmlReq1=getXmlHTTP();
	xmlReq2=getXmlHTTP();
	var Url = sURL+"web/default/module/users/check_exists_email.php";
	Url = Url + "?email=" + email;

	xmlReq1.open("GET", Url, true);
	xmlReq1.onreadystatechange=function(){
		if(xmlReq1.readyState==4){
			var xmlDoc = xmlReq1.responseText
			//alert(xmlDoc);
			if(xmlDoc=='1'){
		       document.getElementById(element_id).style.background='green';
		       document.getElementById('email_message').style.display = 'none';
			}
			else{
			   document.getElementById(element_id).style.background='red';
			   document.getElementById('email_message').style.display = 'block';
			}
		}
	}
	xmlReq1.send(null);
}


///FORUM DISKUSIA/////
var prev_post_id = "";
var diskusform = "";
function addComment(post_id,forum_id) {
	if (document.getElementById(forum_id+'_reaction_'+post_id).innerHTML != "") {
		document.getElementById(forum_id+'_reaction_'+post_id).innerHTML = "";
		document.getElementById('tb_add_comments_'+forum_id).innerHTML = diskusform;
		document.getElementById('form_forums_'+forum_id+'parent_id').value = 'NULL';
	}
	else {
		if (prev_post_id != "") {
			document.getElementById(forum_id+'_reaction_'+prev_post_id).innerHTML = "";
			document.getElementById(forum_id+'_reaction_'+post_id).innerHTML = diskusform;
			document.getElementById('tb_add_comments_'+forum_id).innerHTML = "";
		}
		else {
			diskusform = document.getElementById('tb_add_comments_'+forum_id).innerHTML;
			document.getElementById('tb_add_comments_'+forum_id).innerHTML = "";
			document.getElementById(forum_id+'_reaction_'+post_id).innerHTML = diskusform;
		}
		document.getElementById('form_forums_'+forum_id+'parent_id').value = post_id;
		prev_post_id = post_id;
	}
}


var msgConfirm = "";
function deleteComment(post_id,forum_id) {
	if (confirm (msgConfirm) == "1")
	{
		document.getElementById('form_forums_delete_id').value = post_id;
		document.getElementById('form_forums_action').value = "delete_comments"
		document.getElementById('form_forums_').submit();
	}
}

function PostComment(type,before){

	xmlReq1=getXmlHTTP();
	
	var Url = sURL+"web/default/module/forums/addcomment.php";
	Url = Url + "?parent_id=" + document.getElementById('form_forums_'+type+'parent_id').value;
	Url = Url + "&item_id=" + document.getElementById('form_forums_'+type+'item_id').value;
	Url = Url + "&module_id=" + document.getElementById('form_forums_'+type+'module_id').value;
	Url = Url + "&forum_type=" + type;
	
	//Url = Url + "&title=" + document.getElementById('form_forums_title').value;
	//Url = Url + "&description=" + document.getElementById('form_forums_descr').value;
	
	xmlReq1.open("post", Url);
	xmlReq1.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	
	xmlReq1.onreadystatechange=function(){
		if(xmlReq1.readyState==4){
			var xmlDoc = xmlReq1.responseText;
			
			if(xmlDoc!=''){
				if (before==null) before = '';
				document.getElementById('discussion_'+type).innerHTML=before+xmlDoc.substring(xmlDoc.indexOf('<table'),xmlDoc.lastIndexOf('</table>')+8);
				document.getElementById('form_forums_'+type+'parent_id').value='NULL';
				document.getElementById('form_forums_'+type+'title').focus();
			}
		}
	}
	xmlReq1.send('title='+document.getElementById('form_forums_'+type+'title').value+'&description='+document.getElementById('form_forums_'+type+'descr').value);
}
///FORUM DISKUSIA KONIEC/////


function AddToBasket(module,code,video,added_string,notadded_string){
	xmlReq1=getXmlHTTP();
	var Url = sURL+"web/default/module/mediashop/changebasket.php";
	Url = Url + "?code=" + code;
	Url = Url + "&module=" + module;
	Url = Url + "&video=" + video;
	Url = Url + "&action=add";

	xmlReq1.open("GET", Url, true);
	xmlReq1.onreadystatechange=function(){
		if(xmlReq1.readyState==4){
			var xmlDoc = xmlReq1.responseText
			//alert(xmlDoc);
			if(xmlDoc!=null && xmlDoc!='-1' && document.getElementById("my_basket") != null){
				document.getElementById("my_basket").innerHTML = xmlDoc;
				//alert(added_string);
				showBox('message_box',added_string);
			}
			else{
				//alert(notadded_string);
				showBox('message_box',notadded_string);
			}
		}
	}
	xmlReq1.send(null);
	return false;
}
function DelFromBasket(module,code,video){
	xmlReq1=getXmlHTTP();
	var Url = sURL+"web/default/module/mediashop/changebasket.php";
	Url = Url + "?code=" + code;
	Url = Url + "&module=" + module;
	Url = Url + "&video="+video;
	Url = Url + "&action=del";

	xmlReq1.open("GET", Url, true);
	xmlReq1.onreadystatechange=function(){
		if(xmlReq1.readyState==4){
			var xmlDoc = xmlReq1.responseText
			//alert(xmlDoc);
			if(xmlDoc!=null && document.getElementById("my_basket") != null){
				document.getElementById("my_basket").innerHTML = xmlDoc;
			}
		}
	}
	xmlReq1.send(null);
}
function listCounties(db_estate_country_id,db_estate_county_id,id) {

	xmlReq=getXmlHTTP();
	var Url = sURL+"web/default/template/estate/listCounties.php";
	Url = Url + "?db_estate_country_id=" +db_estate_country_id+"&db_estate_county_id=" + db_estate_county_id +
	"&id="+id;
	xmlReq.open("GET", Url, true);
	xmlReq.onreadystatechange=function(){
		if(xmlReq.readyState==4){
			var xmlDoc = xmlReq.responseText
			if(xmlDoc!=null){
				document.getElementById("city").innerHTML = xmlDoc;
			}
		}
	}
	xmlReq.send(null);
}
function listCities(db_estate_country_id,db_estate_county_id,db_estate_city_id,id) {

	xmlReq=getXmlHTTP();
	var Url = sURL+"web/default/template/estate/listCities.php";
	Url = Url + "?db_estate_country_id=" +db_estate_country_id+"&db_estate_county_id=" + db_estate_county_id +
	"&db_estate_city_id="+db_estate_city_id +"&id="+id;
	xmlReq.open("GET", Url, true);
	xmlReq.onreadystatechange=function(){
		if(xmlReq.readyState==4){
			var xmlDoc = xmlReq.responseText
			if(xmlDoc!=null){
				document.getElementById("city").innerHTML = xmlDoc;
			}
		}
	}
	xmlReq.send(null);
}
function listWards(db_estate_country_id,db_estate_county_id,db_estate_city_id,db_estate_ward) {

	xmlReq=getXmlHTTP();
	var Url = sURL+"web/default/template/estate/listWards.php";
	Url = Url + "?db_estate_country_id=" +db_estate_country_id+"&db_estate_county_id=" + db_estate_county_id +
	"&db_estate_city_id="+db_estate_city_id +"&db_estate_ward="+db_estate_ward;
	xmlReq.open("GET", Url, true);
	xmlReq.onreadystatechange=function(){
		if(xmlReq.readyState==4){
			var xmlDoc = xmlReq.responseText
			if(xmlDoc!=null){
				document.getElementById("ward").innerHTML = xmlDoc;
			}
		}
	}
	xmlReq.send(null);
}

function PostReView(id){
	xmlReq1=getXmlHTTP();
	
	var Url = sURL+"web/default/template/dvd/discussion.php";
	Url = Url + "?dvd_id=" + id;
	
	xmlReq1.open("post", Url);
	xmlReq1.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	
	xmlReq1.onreadystatechange=function(){
		if(xmlReq1.readyState==4){
			var xmlDoc = xmlReq1.responseText;
			
			if(xmlDoc!=''){
				document.getElementById('discussion').innerHTML=xmlDoc.substring(xmlDoc.indexOf('<table'),xmlDoc.lastIndexOf('</table>')+8);
				document.getElementById('form_forums_title').focus();
			}
		}
	}
	xmlReq1.send('title='+document.getElementById('form_dvd_title').value+'&description='+document.getElementById('form_dvd_description').value);
}
function listWardsByCity(db_estate_city_id) {

	xmlReq=getXmlHTTP();
	var Url = sURL+"web/default/template/estate/listWardsByCity.php";
	Url = Url + "?db_estate_city_id="+db_estate_city_id;
	xmlReq.open("GET", Url, true);
	xmlReq.onreadystatechange=function(){
		if(xmlReq.readyState==4){
			var xmlDoc = xmlReq.responseText
			if(xmlDoc!=null){
				document.getElementById("city_ward").innerHTML = xmlDoc;
			}
		}
	}
	xmlReq.send(null);
}

function handleajaxshop(status,id) {
xmlReq1=getXmlHTTP();
	
	var Url = sURL+"web/default/module/shop/ajaxshop.php";
	
	xmlReq1.open("post", Url);
	xmlReq1.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	
	xmlReq1.onreadystatechange=function(){
		if(xmlReq1.readyState==4){
			var xmlDoc = xmlReq1.responseText;
			
			if(xmlDoc!=''){
				document.getElementById('step_frame').innerHTML=xmlDoc;
			}
		}
	}
	
	var delivery='';
	if(status=='d')
	{
		delivery = "&delivery_method="+GetRadio();
			
	}
	key='';
	if(id!='')
	{
		key = "&key="+id;
	}
	//xmlReq1.send('title='+document.getElementById('form_forums_'+type+'title').value+'&description='+document.getElementById('form_forums_'+type+'descr').value);
	xmlReq1.send('id='+status + delivery + key);
}
function changeshipping(keyid,action,id,name,tel,mail,street,zip,city,country,cid,cidtax,cidtax2,companyname){
	xmlReq1=getXmlHTTP();
	
	var Url = sURL+"web/default/module/shop/ajaxshop.php";
	
	xmlReq1.open("post", Url);
	xmlReq1.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	
	xmlReq1.onreadystatechange=function(){
		if(xmlReq1.readyState==4){
			var xmlDoc = xmlReq1.responseText;
			
			if(xmlDoc!=''){
				document.getElementById('step_frame').innerHTML=xmlDoc;
			}
		}
	}
	key='';
	if(keyid!='')
	{
		key = "&key="+keyid;
	}
	
	if(action == "adress_payment_change_save" || action == "addinvoiceaddress" || action =="delinvoiceaddress")
	{
		//alert(asdelivery); 
		if(id!='')
			xmlReq1.send('id='+action+'&payment_address_id='+id +key);
		else
			xmlReq1.send('id='+action+'&name='+name+'&phone='+tel+'&email='+mail+'&street='+street+'&zip='+zip+'&state='+city+'&country_id='+country+'&cid='+cid+'&cid_tax='+cidtax+'&cid_tax2='+cidtax2+'&company_name='+companyname+key);
	}
	if(action == "adress_change_save" || action == "addshipaddress" || action =="delshipaddress"){
		if(id!='')
			xmlReq1.send('id='+action+'&delivery_address_id='+id+key);
		else
			xmlReq1.send('id='+action+'&name='+name+'&phone='+tel+'&email='+mail+'&street='+street+'&zip='+zip+'&state='+city+'&country_id='+country+key);
	}
}

function getAdvancedSearch(module) {
	xmlReq=getXmlHTTP();
	var Url = sURL+"web/default/module/system/getsearchtemplate.php";
	Url = Url + "?module="+module;
	xmlReq.open("GET", Url, true);
	xmlReq.onreadystatechange=function(){
		if(xmlReq.readyState==4){
			var xmlDoc = xmlReq.responseText
			if(xmlDoc!=null){
				document.getElementById("searchtemplate").innerHTML = xmlDoc;
			}
		}
	}
	xmlReq.send(null);
}
function statistics(module,action,id,key){
	xmlReq=getXmlHTTP();
	var Url = sURL+"web/default/module/statistics/play.php";
	Url = Url + "?module=" + module;
	Url = Url + "&id=" + id;
	Url = Url + "&key=" + key;
	Url = Url + "&action=" +action;
	xmlReq.open("GET", Url, true);

	xmlReq.send(null);
	return false;
	
}


