﻿function openwin(url,title,wid,hei) {
  	
  	myWin= open("", "_blank", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+wid+",height="+hei);
  	myWin.document.open();
  	myWin.document.write("<html><head><title>"+title+"</title></head>");
  	myWin.document.write("<body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>");
  	myWin.document.write("<img src='/"+url+"' width='"+wid+"' height='"+hei+"'>");
  	myWin.document.write("</body></html>");
  	myWin.document.close();

	var hWnd = myWin; 
	var nLeftPos, nTopPos; 
	var nWidth = wid;
	var nHeight = hei;
 
    nLeftPos = Math.round(screen.availWidth/2) - Math.round(nWidth/2); 
    nTopPos  = Math.round(screen.availHeight/2) - Math.round(nHeight/2); 
	
	hWnd.moveTo(nLeftPos,nTopPos);

}

String.prototype.trim = function() {
    return this.replace(/(^\s*)|(\s*$)/g, "");
} // -------------------------------------------------------------------------------------------

function truncateForm( form ) {
	for( i = 0 ; i < form.length ; i++ )
	{
	    if( form.elements[i].type == 'text' || form.elements[i].type == 'textarea' )
			form.elements[i].value = form.elements[i].value.trim();
	};
} 

function checkFeedbackForm() {	
	
	truncateForm(document.feedback_form);

	if (document.feedback_form.d_subject.value==0) {
		alert('Укажите, пожалуйста, тему сообщения!');
		return false;
	}

	if (document.feedback_form.d_message.value=="") {
		alert('Извините, Вы не можете отослать пустое сообщение!');
		return false;
	}
	if (document.feedback_form.d_ob.value=="") {
		alert('Введите, пожалуйста, контрольные символы, изображённые на картинке!');
		return false;
	}
	return true;
}


function openwin_swf(url,title,wid,hei) {
 	myWin= open("", "_blank", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,fullscreen=yes");
  	myWin.document.open();
	myWin.document.write("<html><head><title>"+title+"</title></head>");
  	myWin.document.write("<body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'><table width=100% height=100% cellspacing=0 cellpadding=0><tr><td valign=middle align=center>");
  	myWin.document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0\" width="+wid+" height="+hei+"><param name=movie value="+url+"><param name=quality value=high><embed src="+url+" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width="+wid+" height="+hei+"></embed></object>");
  	myWin.document.write("</td></tr></table></body></html>");
  	myWin.document.close();
}
