//popup.js

//resolution
var sw=screen.availWidth;
var sh=screen.availHeight;

function popW(url){
	//popup size
	var ww = sw/2; //window width
	var wh = sh/2+100; //window height
	//LeftPoint and TopPoint
	var lp=sw - (ww+40);
	var tp=sh - (wh+50);
	win = window.open(url,"w","width="+ww+",height="+wh+",left="+lp+",top="+tp+",resizable,scrollbars");
win.focus();
}

//popup for mailing list
function addEmail(){
	em = window.open("addemail.php","m","width=400,height=250,left=100,top=50,resizable");
	em.focus();
}

//popup for sponsor sites
function sponsW(site){
	var sp_w = sw - 200; //window width
	var sp_h = sh - 250; //window height
	var sp_lp = 90;
	var sp_tp = 50;
	wind = window.open(site,"s","width="+sp_w+",height="+sp_h+",left="+sp_lp+",top="+sp_tp+",resizable,scrollbars,menubar,location,status,toolbar");
	wind.focus()
}

//number of friends
function numfr(number,party){
var box = document.forms[0].friend[0]
var n = document.forms[0].name;
var e = document.forms[0].email;

	if(number && box.checked){
		if (n.value && e.value){
		client = document.forms[0].name.value;
		client_email = document.forms[0].email.value;
		fr = window.open("friends.php?num="+number+"&clientname="+client+"&clientemail="+client_email+"&part="+party,"f","width=350,height=400,scrollbars,resizable");
		fr.focus();
		} else {
		alert("Please, enter Your Name and Email address first\n Then Select Again number of friends");
		if (!n.value) n.focus();
		else e.focus();
		document.forms[0].numfriends.selectedIndex=0;
		} //end if (.value)
	} //end if (number)
	return;
}

//popups for Photos
var tall = false;
var wide = false;
var foto1, foto2;

var url="#";
//1 - horisontal photo size, 2 - vertical
function photoPopup(pic,size){
		if (size==1) {
		url = "popupphoto.php?pics="+pic;
				foto1 = window.open(url,"fo1","width=650,height=488,left=30,top=30"); 
				foto1.focus();
				wide=true;
					//closing other popups
				if (tall) {
					foto2.close();
					tall=false;
					}
			}
			else {
			url = "popupphoto.php?pics="+pic;
				foto2 = window.open(url,"fo2","width=500,height=667,left=30,top=30");
				foto2.focus();
				tall=true;
					//closing other popups
				if (wide) {
					foto1.close();
					wide=false;
					}
			}
}//end photoPopup()


//similar function, but for Pamper Party's photos
function photoPop(pic,size){
		if (size==1) {
		url = "popupphoto.php?pics="+pic;
				foto1 = window.open(url,"fo1","width=600,height=400,left=30,top=30"); 
				foto1.focus();
				wide=true;
					//closing other popups
				if (tall) {
					foto2.close();
					tall=false;
					}
			}
			else {
			url = "popupphoto.php?pics="+pic;
				foto2 = window.open(url,"fo2","width=400,height=600,left=30,top=30");
				foto2.focus();
				tall=true;
					//closing other popups
				if (wide) {
					foto1.close();
					wide=false;
					}
			}
}//end photoPopup()
