
function openWind(url,width,height) {
        number = Math.round(Math.random() * 100000000);
        auxWnd = window.open(url, 'newWindow_' + number,'width=' + width + ',height=' + height + ',resizable=yes,scrollprint=yes,toolbar=no,menubar=no,location=no,status=no,directories=no,copyhistory=no,left=0,top=0');
}

function SwapImage(target, fname) {
	document[target].src = fname;
}

function DisplayFlash(path, width, height, wmode){

    text = "<object type=\"application/x-shockwave-flash\" data=\""+path+"\" width=\""+width+"\" height=\""+height+"\" wmode=\""+wmode+"\" quality=\"high\">\r\n";
    text += "<param name=\"movie\" value=\""+path+"\" />\r\n";
    text += "<param name=\"wmode\" value=\""+wmode+"\" />\r\n";
    text += "<param name=\"quality\" value=\"high\" />\r\n";
    text += "<param name=\"width\" value=\""+width+"\" />\r\n";
    text += "<param name=\"height\" value=\""+height+"\" />\r\n";
    text += "</object>";
    document.write(text);
}



function DisplayDiv(ID) {


	atts = document.getElementsByName('attributes');
	for (i = 0; i < atts.length; i++){
		item = atts[i];
		item.style.display = "none";
	}


	if(ID){

		var elem = document.getElementById(ID);
		if(elem)
			document.getElementById(ID).style.display = (document.getElementById(ID).style.display == "none" ) ?  "" :   "none";

	}
}

function ShowHideService(ID) {
	
	if($("#a"+ID).attr("className")=="selected"){
		$("#a"+ID).removeClass("selected");
		$("#"+ID).animate({height: "hide"}, 300);
		return false;
	}
		

	//$("#adds-div a").removeClass("selected");
	$("#a"+ID).addClass("selected");


	//$("#adds-div div").animate({height: "hide"}, 300);
	$("#"+ID).animate({height: "show"}, 300);

}




function ShowHideDiv(a_id, div_id){
	if(a_id){
		if($("#"+a_id).attr("className")=="selected"){
			$("#"+a_id).removeClass("selected");
			$("#"+div_id).animate({height: "hide"}, 700);
			return false;
		}
		else{
			$("#"+a_id).addClass("selected");
			$("#"+div_id).animate({height: "show"}, 700);
		}
			

	}

	else{
		
		$("#"+ID).animate({height: "show"}, 700);

	}


	
}


function PlusMinusResponse(item, action){	
	$.get('/includes/js/jrating.php', {item:item, action:action}, onPlusMinusResponseSuccess);
}


function onPlusMinusResponseSuccess(xml){
	alert(xml);
}



function onAddCommentSuccess(xml){
	if(xml=="-1")
		alert('Такой комментарий уже есть!');
	else if(xml=="1"){
		 $("#ctext").attr("value", "");
		alert('Спасибо! Ваш отзыв успешно добавлен, после проверки модератором он появится на сайте.');

	}
}

function AddComment(item){	

	
	var fio  = $("#cfio").attr("value");
	var text = $("#ctext").attr("value");
	var video = $("#cvideo").attr("value");
	var сpicture = $("#сpicture").attr("value");

	if(!fio){
		alert('Укажите Ваше имя!');
		return false;	
	}
	else if(!text){
		
		alert('Укажите текст отзыва!');	
		return false;	
	}
	
	document.commentform.submit();	
	//$.get('/includes/js/jcommentadd.php', {item:item, fio:fio, text:text, video:video}, onAddCommentSuccess);

}
