// ver. 05.07.2010
/* leap year */function isLeapYear(){var y=this.getFullYear();return(y%4==0&&(y%100!=0||y%400==0));}Date.prototype.isLeapYear=isLeapYear;/* date in month */function date_chkDayInMonth(m,y){return 32 - new Date(y,m,32).getDate();}function date_chkTimeDifference(a,b){var d = new Date();/* check "a" */if(!/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/.test(a)){a=""+d.getDate()+"."+(d.getMonth()+1)+"."+d.getFullYear()};a=a.split(".");a[1]--;if(a[1]>11){a[1]=11};if(a[0]>date_chkDayInMonth(a[1],a[2])){a[0]=date_chkDayInMonth(a[1],a[2])};var m=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"];for (i=0;i<12;i++){if(a[1]==i){a[1]=m[i];break;}};/* check "b" */ if(typeof(b)=="undefined"){b="00:00"};if(!/^(\d{1,2}):{1}(\d{1,2})$/.test(b)){b="00:00"};b=b.split(":");if(b[0]>"23"){b[0]="00"};if(b[1]>"59"){b[1]="00"};b=b[0]+":"+b[1];b=b+":00";/* сalculate */ var c=""+a[1]+","+a[0]+","+a[2]+","+b;var e=new Date(c);c=e-d;return c;}/* event: boolean */function date_chkDate(a,b){var c=date_chkTimeDifference(a,b);if(c<0){c=true}else{c=false};return c;}/* date age */function date_chkAge(a){var d=new Date();var b,f;var c=a.split(".");if(date_chkDate(a)==false){b=1}else{b=0};f=d.getFullYear()-c[2]-b;return f;}/* date get banner */function date_getBanner(a,b,c,d){if(typeof(a)=="undefined"||typeof(b)=="undefined"||typeof(c)=="undefined"||typeof(d)=="undefined"){return false}if (date_chkDate(a)==true && date_chkDate(b)==false){document.getElementById(c).src=d;}}/* date banner replace */function date_replaceBanner(a,b,c,d){if(typeof(a)=="undefined"||typeof(b)=="undefined"||typeof(c)=="undefined"||typeof(d)=="undefined"){return false}var i=new Image();i=[d];if (date_chkDate(a)==false){document.getElementById(c).src=d;}if (date_chkDate(b)==true){document.getElementById(c).src=d;}}/* create window */var kpWindow=new Array();function window_wOpen(a,b,c,d){if(typeof(c)=="undefined"){var c=0}else{c=parseInt(c)};if(typeof(d)=="undefined"){var d="myWindow"+c};if(typeof(b)=="undefined"){var b="width=640,height=480,status=no,toolbar=no,menubar=no"}else{b=b.split(",");b="width="+b[0]+",height="+b[1]+"status=no,toolbar=no,menubar=no"};kpWindow[c]=open(a,d,b);kpWindow[c].focus();}/* close window */function window_wClose(a){if(typeof(a)=="undefined"){var a=0};kpWindow[a].close();}/* write window */function window_wWrite(a,b,c){window_wOpen("",b,c);if(typeof(a)=="undefined"){var a="Пустое окно"};if(typeof(b)=="undefined"){var b="600,400"};if(typeof(c)=="undefined"){var c=0};kpWindow[c].document.write(a);kpWindow[c].focus();}/* dom move element */function dom_moveElementBefore(a,b){if(typeof(a)=="undefined"){return false};if(typeof(b)=="undefined"){var b="inner-left"};var findElement=document.getElementById(b);if(findElement==null){return false};var moveElement=document.getElementById(a);if(moveElement==null){return false};findElement.parentNode.insertBefore(moveElement,findElement);}/* dom insert first child */function dom_moveElementFC(a,b){if(typeof(a)=="undefined"){return false};if(typeof(b)=="undefined"){var b="inner-left"};var findElement=document.getElementById(b);if(findElement==null){return false};var moveElement=document.getElementById(a);if(moveElement==null){return false};findElement.insertBefore(moveElement,findElement.firstChild);}/* dom insert last child */function dom_moveElementLC(a,b){if(typeof(a)=="undefined"){return false};if(typeof(b)=="undefined"){var b="inner-left"};var findElement=document.getElementById(b);if(findElement==null){return false};var moveElement=document.getElementById(a);if(moveElement==null){return false};findElement.appendChild(moveElement,findElement);}/* dom remove element */function dom_removeElement(a){if(typeof(a)=="undefined"){return false}var findElement=document.getElementById(a);findElement.parentNode.removeChild(findElement)}/* get random number*/function random_getNumber(a){if(typeof(a)=="undefined"){var a="0,9"};var c=a.split(",");c[0]=parseInt(c[0]);c[1]=parseInt(c[1]);var r=Math.floor(((c[1]-1)-(c[0]-1)+1)*Math.random());return r;}/*switch off cache*/function random_noCache(a){if(typeof(a)=="undefined"){a="http://kp.ru"}a=""+a+"?"+random_getNumber("1000,9999");location.href=a;}/* url go to */function url_goTo(a){if(typeof(a)=="undefined"){a="http://kp.ru"}location.href=a;}/* url test box */function url_testBox(a,b){if(typeof(a)=="undefined"||typeof(b)=="undefined"){return false};if(location.href==a){document.getElementById(b).style.display='block';}}/* TIMER */var date_eventQuery1,date_eventQuery2,date_eventId,date_eventTitle1,date_eventTitle2;function date_chkEvent(a,b,c,d,e){/* check params */var t = new Date();t=""+t.getDate()+"."+t.getMonth()+"."+t.getFullYear();if(typeof(a)=="undefined"){var a=t};if(b==""){b=t};if(typeof(b)=="undefined"){var b="00:00"};if(b==""){b="00:00"};if(typeof(c)=="undefined"){var c="myevent"};if(c==""){c="myevent"};if(typeof(d)=="undefined"){var d=""};if(typeof(e)=="undefined"){var e=""};/* get date */var f=date_chkTimeDifference(a,b);var ffs=parseInt(f/1000); /* full seconds */var fd=parseInt(ffs/(24*60*60)); /* full days */var fh=parseInt((ffs-fd*24*3600)/3600); /* hours in days */var fm=parseInt(((ffs-fd*24*3600)-fh*3600)/60); /* min in hours */var fs=((ffs-fd*24*3600)-fh*3600);fs=parseInt(fs-fm*60); /* sec in min *//* get text */if(f>0){var text="<strong style=\"timer_title\">"+d+"<\/strong> ";text+="<style type=\"text\/css\">\nstrong.timer_body{color:#991111}\n<\/style>";if(fd>0){text+="<strong class=\"timer_body\">"+fd+"<\/strong> дн. "}if(fh>0){text+="<strong class=\"timer_body\">"+fh+"<\/strong> час. "}if(fm>0){text+="<strong class=\"timer_body\">"+fm+"<\/strong> мин. "}text+="<strong class=\"timer_body\">"+fs+"<\/strong> сек.";document.getElementById(c).innerHTML=text;/* recursion function */date_eventQuery1=a;date_eventQuery2=b;date_eventId=c;date_eventTitle1=d;date_eventTitle2="<strong style=\"timer_title\">"+e+"<\/strong>";setTimeout('date_chkEvent(date_eventQuery1,date_eventQuery2,date_eventId,date_eventTitle1,date_eventTitle2)',10);}else{document.getElementById(c).innerHTML="<strong class=\"mytimer\">"+e+"<\/strong>"}}/* hide photo */var whBox=new Array();var whHidden=new Array();var hidHead=new Array();var hidContent=new Array();var hidBottom=new Array();function show_hiddenPhoto(a){if(typeof(a)=="undefined"){return false};if(a==0){document.write('<\/div>');}else{var n=parseInt(a);hidHead[n]="myHead"+n;hidContent[n]="myContent"+n;hidBottom[n]= "myButton"+n;if(typeof(whBox[n])=="undefined"){var t='<style type=\"text\/css\">\na#'+hidBottom[n]+':link, a#'+hidBottom[n]+':visited, a#'+hidBottom[n]+':active { font-weight: bold; font-size: 11px; display: block; text-decoration: none; padding: 8px; background: #911; color: #fff; }\na#'+hidBottom[n]+':hover { background: #000; }\n#'+hidContent[n]+' { display: none; }\n<\/style>\n<p id=\"'+hidHead[n]+'\"><a id=\"'+hidBottom[n]+'\" title=\"Показать фото\" onclick=\"show_hiddenPhoto('+a+');return false;\" href=\"#\">ОСТОРОЖНО: шокирующее фото! Не рекомендуем смотреть впечатлительным людям. Показать &raquo;<\/a><\/p>\n<div id=\"'+hidContent[n]+'\">';document.write(t);whBox[n]=true;}if (whHidden[n]==false){whHidden[0]=null;for (var i=1;i<whHidden.length;i++){if(typeof(whHidden[i])=="undefined"){break;}else{document.getElementById(hidContent[i]).style.display="block";document.getElementById(hidHead[i]).style.display="none";}}}whHidden[n]=false;}}var getKpSpoiler=1;/* switch spoiler */function switchKpSpoiler(){if(getKpSpoiler==1){document.getElementById('sBody').style.display='block';document.getElementById('sVisible').style.display='none';document.getElementById('sHidden').style.display='block';getKpSpoiler=0;}else{document.getElementById('sHidden').style.display='none';document.getElementById('sVisible').style.display='block';document.getElementById('sBody').style.display='none';getKpSpoiler=1;}}/* spoiler */var fg2010=false;function show_getSpoiler(a){if(typeof(a)=="undefined"){return false;}fg2010=true;var b=parseInt(a);if(b==1){var t='<style type=\"text\/css\">#sVisible,#sHidden{line-height:22px;font-family:Tahoma,sans-serif;font-weight:bold; font-size:11px;color:#fff;}\n#sVisible{display:block;border-bottom:1px dotted #666;}\n#sHidden{display:none}\n#sButt{width:100px;height:22px;background:#568fc1;text-align:center;}\n#sButt a{text-decoration:none;}\n#sBody{padding:5px;border:1px solid #999;display:none;}<\/style>\n<div>\n<div id=\"sButt\">\n<a href=\"#\" onclick=\"switchKpSpoiler();return false;\">\n<span id=\"sVisible\">Показать &raquo;<\/span>\n<span id=\"sHidden\">Скрыть &laquo;<\/span><\/a><\/div>\n<div id=\"sBody\">';document.write(t);}else if(b==0&&fg2010==true){document.write('<\/div><\/div>')}else{return false}}var locKpRedir=window.location;if(locKpRedir.search=="?libmehelp"){location.href="http://chel.kp.ru/upfile/attached_file/666755.html"}
