<!--
var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false");

function promptadvwidth(w1, h1) {
if (pwidth=prompt("Колко пиксела искате да е широко Вашето рекламно поле?:", "")) {
if (pwidth==0) {
alert("0 не е валидна стойност!");
promptadvwidth(w1, h1);
}else{
promptadvheight(w1, h1, pwidth);
}
}else{
if(confirm("Трябва да въведете стойност!\nПродължи?")) {
promptadvwidth(w1, h1);
}else{
return false;
}
}
}


function promptadvheight(w2, h2, p2width) {
if (p2height=prompt("Колко пиксела искате да е дълго Вашето рекламно поле?:", "")) {
if (p2height==0) {
alert("0 не е валидна стойност!");
promptadvheight(w2, h2, p2width);
}else{
promptadvcalculate(w2, h2, p2width, p2height);
}
}else{
if(confirm("Трябва да въведете стойност!\nПродължи?")) {
promptadvheight(w2, h2, p2width);
}else{
return false;
}
}
}


function promptadvcalculate(x, y, xw, yh) {

//dyljina na grid-a
dw = "652";
//visochina na grid-a
dh = "1002";
//cena v leva za 100x100 piksela
pixcena = "3";



Fx = parseFloat(x);
Fxw = parseFloat(xw);
Fy = parseFloat(y);
Fyh = parseFloat(yh);
Fdw = parseFloat(dw);
Fdh = parseFloat(dh);

if (Fx+Fxw>Fdw) {
alert("Въвели сте прекалено голяма стойност за дължина за тази позиция!\nРекламата ще излезе извън мрежата.");
window.history.go();
}else{
if (Fy+Fyh>Fdh) {
alert("Въвели сте прекалено голяма стойност за височина за тази позиция!\nРекламата ще излезе извън мрежата.");
window.history.go();
}else{
//Smqtaj
cena = (Fxw*Fyh/10000)*pixcena;
if (confirm("Вашето рекламно каре струва: "+cena+" лева.\nНатиснете OK, за да го купите")) {
parent.top.location.href='adv.php?go=buy&clientX='+Fx+'&clientY='+Fy+'&width='+Fxw+'&height='+Fyh;
}else{
return false;
}
}
}

}


function goBuy(e) {
bwidth = e.clientX;
bheight = e.clientY;
if (confirm("Вие избрахте място с координати:\n"+bwidth+"px дължина и "+bheight+"px височина.\nКупувай?")) {
promptadvwidth(bwidth, bheight);
}else{
return false;
}
}

function checkBrowser(){
this.ver=navigator.appVersion
this.dom=document.getElementById?1:0
this.ie5=(this.ver.indexOf("MSIE 5")>-1 & this.dom)?1:0;
this.ie4=(document.all & !this.dom)?1:0;
this.ns5=(this.dom & parseInt(this.ver) >= 5) ?1:0;
this.ns4=(document.layers & !this.dom)?1:0;
this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
return this
}
bw=new checkBrowser()
fromLeft=10
fromTop=10
function cursorInit(){
oCursor=new makeCursorObj('divCursor')
scrolled=bw.ns4 || bw.ns5?"window.pageYOffset":"document.body.scrollTop"
if(bw.ns4)document.captureEvents(Event.MOUSEMOVE)
document.onmousemove=move;
}
function makeCursorObj(obj,nest){
nest=(!nest) ? '':'document.'+nest+'.' 
    this.css=bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0; 
this.moveIt=b_moveIt; 
return this
}
function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x; this.css.top=this.y}
function move(e){
x=bw.ns4 || bw.ns5?e.pageX:event.x
y=bw.ns4 || bw.ns5?e.pageY:event.y
if(bw.ie4 || bw.ie5) y=y+eval(scrolled)
oCursor.moveIt(x+fromLeft,y+fromTop)
}
onload=cursorInit;

function hidefreepix() {
document.getElementById('divCursor').style.display='none';
}

function showfreepix() {
document.getElementById('divCursor').style.display='';
}
//-->