// ##########################################
// #########  FLASH SCRİPT  ###############
// ##########################################
function getSWF(swWidth, swHeight, swFile, swWmode)
{
	var str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width='+swWidth+' height='+swHeight+' VIEWASTEXT>';
	str += ' <param name="movie" value="'+swFile+'" /> ';
	str += ' <param name="quality" value="high" /> ';
	str += ' <param name="allowDomain" value="*" /> ';
	// wmode = window, transparent, opaque
	str += ' <param name="wmode" value="'+swWmode+'" /> ';
	str += ' <param name="menu" value="false" /> ';
	str += ' <embed src="'+swFile+'" allowDomain="*" width='+swWidth+' height='+swHeight+' quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false" wmode="'+swWmode+'"></embed> ';
	str += ' </object> ';
	document.write(str);
}

function NSO(){
	window.open('NasilOynanir.aspx','NSO','width=700, height=450, left=100, top=100, scrollbars=1');
}

function KKO(){
	window.open('KatilimKosullari.aspx','KKO','width=700, height=450, left=100, top=100, scrollbars=1');
}

function HDO(){
	window.open('Hediyeler.aspx','HDO','width=683, height=537, left=100, top=100, scrollbars=0');
}

function OpenCenterPopup(URL, winName, W, H, prop){
	var w=screen.width;
	var h=screen.height;
	var x=parseInt((w-W)/2);
	var y=parseInt((h-H)/2);
	window.open(URL,winName,'width=' + W + ',height=' + H + ',left=' + x + ',top=' + y + prop);
}

function setKart(val)
{
	document.oyun.Kart.value=val;
}

function Preview()
{
	if (checkMesaj()){
		document.oyun.target="frameKart";
		document.oyun.action = 'KampanyaEkart.asp';
		document.oyun.submit();
	}
}

function sendBonus()
{
	isFormOk = checkFormEK();
	if(isFormOk){
		document.oyun.target="_self";
		document.oyun.action = 'CheckMember.aspx';
		document.oyun.submit();
	}
}

function checkEmail(str) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(str)){return true;}
	else{return false;}
}

function checkMesaj()
{
	if (document.oyun.Mesaj.value.length<=0){
		alert("Lütfen mesajınızı giriniz!");
		document.oyun.Mesaj.focus();
		return false;
	}
	if (document.oyun.Mesaj.value.length>50){
		alert('Mesajınız 50 karakterden fazla olmamalıdır');
		document.oyun.Mesaj.focus();
		return false;
	}
	return true;
}
function checkFormEK()
{
	if (!checkMesaj()){return false;}
	var dolu=0;
	for (i=1;i<=5;i++){
		if((eval('document.oyun.Name' + i).value.length>0)&&(eval('document.oyun.Surname' + i).value.length>0)&&(eval('document.oyun.Email' + i).value.length>0)){
			dolu=+1;
			isValid = checkEmail(eval('document.oyun.Email' + i).value);
			if(!isValid){alert("Lütfen geçerli bir e-posta adresi giriniz!"); eval('document.oyun.Email' + i).focus(); return false;}
			for(t=1;t<=5;t++){
				if(i!=t&&eval('document.oyun.Email' + i).value==eval('document.oyun.Email' + t).value){
					alert('E-kart göndereceğiniz e-posta adresleri birbirinden farklı olmalı!');
					eval('document.oyun.Email' + t).focus();
					return false;
				}
			}
		}
	}
	if(dolu==0){alert("E-kartınızı en az bir arkadaşınıza göndermelisiniz!");document.oyun.Name1.focus();return false;}
	return true;
}