﻿<!--

var flash = 0;
function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_setTextOfLayer(objName,x,newText) {//v3.0A Modified by Uncle Massimo and packaged by Uncle Al  for NN6 Compatibility
	var obj = (document.getElementById) ? MM_findObj(objName) : MM_findObj(objName);
	if (obj!=null) with (obj)
		if (document.layers) {document.write(unescape(newText)); document.close();}
		else innerHTML = unescape(newText);
}
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
	obj.visibility=v; }
}

function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	 if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_displayStatusMsg(msgStr)  { //v3.0
	window.status=msgStr; document.MM_returnValue = true;
}

function showFlash6Animation( isPlugin, id, swfSrc, swfWidth, swfHeight, flashVars ) {
	if ( isPlugin ) {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write('  codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
		document.write(' id="'+id+'" width="'+swfWidth+'" height="'+swfHeight+'">');
		document.write(' <param name="movie" value="'+swfSrc+'"> <param name=quality value=high> <param name="menu" value="false"> <param name="bgcolor" value="#f6f6f6"> <param name="scale" value="noscale"> <param name=devicefont value=false> <param name="FlashVars" value="'+flashVars+'"> ');
		document.write(' <embed src="'+swfSrc+'" quality=high bgcolor="#f6f6f6" scale="noscale" devicefont=false FlashVars="'+flashVars+'" ');
		document.write(' swLiveConnect="false" width="'+swfWidth+'" height="'+swfHeight+'"');
		document.write(' type="application/x-shockwave-flash" PLUGINSPAGE="https://www.macromedia.com/go/getflashplayer">');
		document.write(' </embed>');
		document.write(' </object>');
	}
}

//	Wyswietlanie parametrycznego naglowka strony
function showMADheader(isPlugin, jHeadSlogan, jHeadPageTitleLevel1, jHeadPageTitleLevel2, hHeadSlogan, hHeadPageTitleLevel1, hHeadPageTitleLevel2,headName,headImg) {
	(isPlugin) ? emptyTxt = '' : emptyTxt = '&nbsp;';
	flashVars = '?dummy=dummy&';
	(jHeadSlogan=='') ? jHeadSlogan = emptyTxt : flashVars += 'jHeadSlogan=' + jHeadSlogan; 
	(jHeadPageTitleLevel1=='') ? jHeadPageTitleLevel1 = emptyTxt : flashVars += '&jHeadPageTitleLevel1=' + jHeadPageTitleLevel1; 
	(jHeadPageTitleLevel2=='') ? jHeadPageTitleLevel2 = emptyTxt : flashVars += '&jHeadPageTitleLevel2=' + jHeadPageTitleLevel2; 
	
	if (headName==null) headName = "MADheader.swf";
	if (headImg==null) headImg = "photo_head_1.jpg";
	
	if (isPlugin) {
		showFlash6Animation( isPlugin, 'MADheader', 'swf/'+headName, 766, 147, flashVars );
		flash = isPlugin;
	} else {
		document.writeln('<table border="0" cellspacing="0" cellpadding="0" width="766">');
		document.writeln('<tr>');
		document.writeln('<td rowspan="2" width="8" class="headBack1"><img src="img/pix.gif" alt="" width="8" height="1"></td>');
		document.writeln('<td width="234" class="haslo" valign="top">');
		document.writeln('<img src="img/pix.gif" alt="" width="234" height="8"><br>');
		document.writeln('<div id="jHeadSlogan">'+hHeadSlogan+'</div>');
		document.writeln('</td>');
		document.writeln('<td rowspan="2" width="6" class="headBack1"><img src="img/pix.gif" alt="" width="6" height="1"></td>');
		document.writeln('<td rowspan="2" width="10" class="headBack2"><img src="img/pix.gif" alt="" width="10" height="1"></td>');
		document.writeln('<td rowspan="2" width="261" class="headBack2" valign="bottom"><div id="jHeadPageTitleLevel2">'+hHeadPageTitleLevel2+'</div></td>');
		document.writeln('<td rowspan="2" width="247" align="right"><img src="img/'+headImg+'" alt="" width="247" height="147"></td>');
		document.writeln('</tr><tr>');
		document.writeln('<td width="234" class="headBack1" valign="bottom" align="right"><div id="jHeadPageTitleLevel1">'+hHeadPageTitleLevel1+'</div></td>');
		document.writeln('</tr>');
		document.writeln('</table>');
	}	
}

//	Sprawdz czy jest zdefiniowany
function isUndefined(txtString){
	if(navigator.appName!="Netscape"){
		if(txtString==null ){ txt=""; } else { txt=txtString; }
	} else {
		if(txtString==undefined ){ txt=""; } else { txt=txtString; }
	}
	return(txt);
}

var menuNewsYear = "null";

//	MAIN MENU
function pageHeaderGen(dzial, lang, is2){
	tab = new Array;
	site = new String(location.href);
	nLang = lang;
	if(nLang=="") nLang = "pl.";
	
	// Link names in different languages
	allNames = new Array;
	allNames["pl."] = new Array;
	allNames["en."] = new Array;
	
	allNames["pl."]["home"] = "HOME";
	allNames["en."]["home"] = "HOME";
	
	allNames["pl."]["MADcards"] = "MADcards";
	allNames["en."]["MADcards"] = "MADcards";
	
	allNames["pl."]["MADgames"] = "MADgames";
	allNames["en."]["MADgames"] = "MADgames";
	
	allNames["pl."]["praca"] = "PRACA";
	allNames["en."]["praca"] = "JOB";
	
	allNames["pl."]["lang"] = "English";
	allNames["en."]["lang"] = "Polski";
	
	allNames["pl."]["firma"] = "FIRMA";
	allNames["en."]["firma"] = "FIRM";
	
	allNames["pl."]["oferta"] = "OFERTA";
	allNames["en."]["oferta"] = "OFFER";
	
	allNames["pl."]["realizacje"] = "REALIZACJE";
	allNames["en."]["realizacje"] = "PORTFOLIO";
	
	allNames["pl."]["klienci"] = "KLIENCI";
	allNames["en."]["klienci"] = "CLIENTS";
	
	allNames["pl."]["news"] = "AKTUALNOŚCI";
	allNames["en."]["news"] = "NEWS ARCHIVE";
	
	allNames["pl."]["extranet"] = "EXTRANET";
	allNames["en."]["extranet"] = "EXTRANET";
	
	allNames["pl."]["kontakt"] = "KONTAKT";
	allNames["en."]["kontakt"] = "CONTACT";
		
	
	if(dzial!="home"){ tab[dzial] = "S"; } else { tab[dzial]="Down"; }
	
	extranet_logged = "no";
	//	Adres dla linku extranet
	extranel_url = "";
	if(extranet_logged=="yes"){
		//	Zalogowany
		extranet_url = "MADforma?PAGE="+ lang +"www.login";
	} else {
		//	Niezalogowany
		extranet_url = "MADforma?PAGE="+ lang +"www.login";
	}
	
	//javascript:exit(\'newTask_group\',\'www.job\');
	
	document.writeln('<table border="0" cellspacing="0" cellpadding="0"><tr valign="middle">');
	document.writeln('		');

//	document.writeln('		<td class="mTblMenu2'+ isUndefined(tab["MADgames"]) +'" id="jUpMenu1"><a href="');
//	
//		if(is2=="y"){
//			document.write('MADforma?PAGE='+ lang +'www.games');
//		} else {
//			document.write('javascript:exit(\'newTask_group\',\'MADforma?PAGE='+ lang +'www.games\');');
//		}
//	
//	document.write('">'+ allNames[nLang]["MADgames"] +'</a></td>');
//	document.writeln('		<td class="mTblMenu2" width="15"><img src="img/pix.gif" alt="" width="15" height="1"></td>');
//	document.writeln('		');

/*
	document.writeln('		<td class="mTblMenu2'+ isUndefined(tab["MADcards"]) +'" id="jUpMenu1"><a href="');
	
		if(is2=="y"){
			document.write('MADcards?PAGE='+ lang +'cards.choose&dc.category=8');
		} else {
			document.write('javascript:exit(\'newTask_group\',\'MADcards?PAGE='+ lang +'cards.choose&dc.category=8\');');
		}
	
	document.write('">'+ allNames[nLang]["MADcards"] +'</a></td>');
	document.writeln('		<td class="mTblMenu2" width="15"><img src="img/pix.gif" alt="" width="15" height="1"></td>');
*/	
	document.writeln('		<td class="mTblMenu2'+ isUndefined(tab["lang"]) +'" id="jUpMenu3"><a href="');
	
	if(site.substring((site.length-8),(site.length))=="MADforma"){
		site="MADforma"+getCookie("MADformaLang");
		site=site.replace(/MADforma&PAGE=/g,"MADforma?PAGE=");
	}
	
	if(site.indexOf("?PAGE=en")== -1 )
	{
		site=site.replace(/PAGE=/g,"PAGE=en.");
	}else{
		site=site.replace(/PAGE=en./g,"PAGE=");
	}
	
	if(is2=="y"){
		document.write(site.toString());
	} else {
	
	page = site.substring(site.indexOf("PAGE=")+5,site.length);
		document.write('javascript:exit(\'newTask_group\',\''+page+'\');');
				
	}
	
	
	document.write('">'+ allNames[nLang]["lang"] +'</a></td>');
	document.writeln('		');
	document.writeln('		<td width="11"><img src="img/pix.gif" alt="" width="10" height="18"></td>');
	document.writeln('	</tr></table></td>');
	document.writeln('	');
	document.writeln('	<!-- Koniec pierwszego menu //-->');
	document.writeln('</tr>');
	document.writeln('<tr>');
	document.writeln('	<td width="249"><img src="img/pix.gif" alt="" width="249" height="1"></td>');
	document.writeln('	<td width="519" class="mTblBorder"><img src="img/pix.gif" alt="" width="519" height="1"></td>');
	document.writeln('</tr>');
	document.writeln('<tr>');
	document.writeln('	<td width="249"><table border="0" cellspacing="0" cellpadding="0" width="249">');
	document.writeln('	');
	document.writeln('		<tr>');
	document.writeln('			<td width="122" align="left"><img src="img/logo_mad.gif" alt="MAD Multimedia" width="112" height="16"></td>');
	document.writeln('			<td width="112" class="menu'+ isUndefined(tab["home"]) +'" align="right" id="jUpMenuHome"><a href="');
	
		if(is2=="y"){
			document.write('MADforma?PAGE='+ lang +'www.home');
		} else {
			document.write('javascript:exit(\'newTask_group\',\'MADforma?PAGE='+ lang +'www.home\');');
		}
	
	document.write('">'+ allNames[nLang]["home"] +'</a></td>');
	document.writeln('			<td width="10"><img src="img/pix.gif" alt="" width="10" height="1"></td>');
	document.writeln('		</tr>');
	document.writeln('		');
	document.writeln('	</table></td>');
	document.writeln('	');
	document.writeln('	<td width="519" align="right"><table border="0" cellspacing="0" cellpadding="0" width="519"><tr>');
	document.writeln('		<td class="mTblMenu1" width="5"><img src="img/pix.gif" alt="" width="5" height="1"></td>');
	document.writeln('		<td class="mTblMenu1'+ isUndefined(tab["firma"]) +'" width="50" align="right" id="jUpMenu2Firma"><a href="');
	
		if(is2=="y"){
			document.write('MADforma?PAGE='+ lang +'www.firm');
		} else {
			document.write('javascript:exit(\'newTask_group\',\'MADforma?PAGE='+ lang +'www.firm\');');
		}
	
	document.write('">'+ allNames[nLang]["firma"] +'</a></td>');
	document.writeln('		<td class="mTblMenu1" width="5"><img src="img/pix.gif" alt="" width="5" height="1"></td>');
	document.writeln('		<td class="mTblMenu1'+ isUndefined(tab["oferta"]) +'" width="65" align="right" id="jUpMenu2Oferta"><a href="');
	
		if(is2=="y"){
			document.write('MADforma?PAGE='+ lang +'www.offer');
		} else {
			document.write('javascript:exit(\'newTask_group\',\'MADforma?PAGE='+ lang +'www.offer\');');
		}
	
	document.write('">'+ allNames[nLang]["oferta"] +'</a></td>');
	document.writeln('		<td class="mTblMenu1" width="5"><img src="img/pix.gif" alt="" width="5" height="1"></td>');
	document.writeln('		<td class="mTblMenu1'+ isUndefined(tab["realizacje"]) +'" width="77" align="right" id="jUpMenu2Realizacje"><a href="');
	
		if(is2=="y"){
			document.write('MADforma?PAGE='+ lang +'www.portfolio&dc.selected=null');
		} else {
			document.write('javascript:exit(\'newTask_group\',\'MADforma?PAGE='+ lang +'www.portfolio&dc.selected=null\');');
		}
	var clalign = "right";
	if (nLang!="pl.") clalign = "center";
	document.write('">'+ allNames[nLang]["realizacje"] +'</a></td>');
	document.writeln('		<td class="mTblMenu1" width="5"><img src="img/pix.gif" alt="" width="5" height="1"></td>');
	document.writeln('		<td class="mTblMenu1'+ isUndefined(tab["klienci"]) +'" width="68" align="'+clalign+'" id="jUpMenu2Klienci"><a href="');
	
		if(is2=="y"){
			document.write('MADforma?PAGE='+ lang +'www.clients');
		} else {
			document.write('javascript:exit(\'newTask_group\',\'MADforma?PAGE='+ lang +'www.clients\');');
		}
	
	document.write('">'+ allNames[nLang]["klienci"] +'</a></td>');
	document.writeln('		<td class="mTblMenu1" width="5"><img src="img/pix.gif" alt="" width="5" height="1"></td>');
	document.writeln('		<td class="mTblMenu1'+ isUndefined(tab["news"]) +'" width="84" align="right" id="jUpMenu2Aktualnosci"><a href="');
	
		if(is2=="y"){
			document.write('MADforma?PAGE='+ lang +'www.news&dc.year='+ menuNewsYear +'');
		} else {
			document.write('javascript:exit(\'newTask_group\',\'MADforma?PAGE='+ lang +'www.news&dc.year='+ menuNewsYear +'\');');
		}
	
	document.write('">'+ allNames[nLang]["news"] +'</a></td>');
	document.writeln('		<td class="mTblMenu1" width="5"><img src="img/pix.gif" alt="" width="5" height="1"></td>');
	
	document.writeln('		<td class="mTblMenu1'+ isUndefined(tab["extranet"]) +'" width="62" align="right" id="jUpMenu2Extranet"><a href="');
	
		if(is2=="y"){
			document.write(''+ extranet_url +'');
		} else {
			document.write('javascript:exit(\'newTask_group\',\''+ extranet_url +'\');');
		}
	
	document.write('">'+ allNames[nLang]["extranet"] +'</a></td>');
	document.writeln('		<td class="mTblMenu1" width="5"><img src="img/pix.gif" alt="" width="5" height="1"></td>');
	
	document.writeln('		<td class="mTblMenu1'+ isUndefined(tab["praca"]) +'" width="42" align="right" id="jUpMenu2Extranet"><a href="');
	
		if(is2=="y"){
			document.write('MADforma?PAGE='+ lang +'www.job');
		} else {
			document.write('javascript:exit(\'newTask_group\',\'MADforma?PAGE='+ lang +'www.job\');');
		}
	
	document.write('">'+ allNames[nLang]["praca"] +'</a></td>');
	document.writeln('		<td class="mTblMenu1" width="5"><img src="img/pix.gif" alt="" width="5" height="1"></td>');
	
	document.writeln('		<td class="mTblMenu1'+ isUndefined(tab["kontakt"]) +'" width="66" align="right" id="jUpMenu2Kontakt"><a href="');
	
		if(is2=="y"){
			document.write('MADforma?PAGE='+ lang +'www.contact');
		} else {
			document.write('javascript:exit(\'newTask_group\',\'MADforma?PAGE='+ lang +'www.contact\');');
		}
	
	document.write('">'+ allNames[nLang]["kontakt"] +'</a></td>');
	document.writeln('		<td class="mTblMenu1" width="10"><img src="img/pix.gif" alt="" width="10" height="16"></td>');
	document.writeln('	</tr></table>');
	
}


function ENpageHeader(dzial){
	
	pageHeaderGen(dzial,"en.","y");
}

function pageHeader(dzial){
	
	pageHeaderGen(dzial,"","y");
	
  
}
function pageHeader2(dzial){
	
	pageHeaderGen(dzial,"","n");
	
  
}


function ENpageHeader2(dzial){
	pageHeaderGen(dzial,"en.","n");
}

function setCookie(name,value) {
     document.cookie = name + "=" +escape(value);
}

function getCookie(Name) {
   var search = Name + "="
   if (document.cookie.length > 0) {
      offset = document.cookie.indexOf(search) 
      if (offset != -1) {
         offset += search.length 
         end = document.cookie.indexOf(";", offset) 
         if (end == -1) 
            end = document.cookie.length
         return unescape(document.cookie.substring(offset, end))
      }
   }
	 return "";
}

function MC_init(){

	document.forms[0].elements['dc.selectedItem.from_mail'].value = getCookie("MC_from_mail");
	document.forms[0].elements['dc.selectedItem.from_name'].value = getCookie("MC_from_name");
	document.forms[0].elements['dc.selectedItem.to_mail'].value = getCookie("MC_to_mail");
	document.forms[0].elements['dc.selectedItem.to_name'].value = getCookie("MC_to_name");
	document.forms[0].elements['dc.selectedItem.wishes'].value = getCookie("MC_wishes");
	
	wishes = document.forms[0].elements['dc.selectedItem.wishes'].value;
	wishes = wishes.replace(/<br>/g,"");
	wishes = wishes.replace(/&lt;/g,"<");
	
	
	document.forms[0].elements['dc.selectedItem.wishes'].value = wishes;

}


function cardFlashShow(cFile,altFile,cW,cH,cName){

		var MM_contentVersion = 5;
		if ( flash ) {
			document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
			document.write('  codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" ');
			document.write('ID="'+cName+'" WIDTH="'+cW+'" HEIGHT="'+cH+'" ALIGN="">');
			document.write(' <PARAM NAME="movie" VALUE="kartki/'+cFile+'"> <PARAM NAME="quality" VALUE="high"> <PARAM NAME="bgcolor" VALUE="#FFFFCC">  '); 
			document.write(' <EMBED src="kartki/'+cFile+'" quality=high bgcolor=#FFFFCC  ');
			document.write(' swLiveConnect=FALSE WIDTH="'+cW+'" HEIGHT="'+cH+'" NAME="'+cName+'" ALIGN=""');
			document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="https://www.macromedia.com/go/getflashplayer">');
			document.write(' </EMBED>');
			document.write(' </OBJECT>');
		} else{
			document.write('<IMG SRC="kartki/'+ altFile +'" WIDTH="'+cW+'" HEIGHT="'+cH+'" usemap="#'+cName+'" BORDER="0">');
		}

}


function checkSubmit(){
	check = 0;
	
	mail = document.forms[0].elements['dc.selectedItem.from_mail'].value;
	hook = mail.indexOf('@');
	if(hook<=0){
		check = 1;
		alert("Adres Nadawcy powinien zawierać '@'");
	} else {
		hook2 = mail.lastIndexOf('.');
		if(hook2<hook){
			check = 1;
			alert("Niepoprawny email Nadawcy");
		}
	}
	
	mail = document.forms[0].elements['dc.selectedItem.to_mail'].value;
	hook = mail.indexOf('@');
	if(hook<=0){
		check = 1;
		alert("E-mail Odbiorcy powinien zawierać '@'");
	} else {
		hook2 = mail.lastIndexOf('.');
		if(hook2<hook){
			check = 1;
			alert("Niepoprawny e-mail Odbiorcy");
		}
	}
	
	return(check)
}

function ENcheckSubmit(){
	check = 0;
	
	mail = document.forms[0].elements['dc.selectedItem.from_mail'].value;
	hook = mail.indexOf('@');
	if(hook<=0){
		check = 1;
		alert("The Sender's email address must contain a '@'");
	} else {
		hook2 = mail.lastIndexOf('.');
		if(hook2<hook){
			check = 1;
			alert("Incorrect Sender's address");
		}
	}
	
	mail = document.forms[0].elements['dc.selectedItem.to_mail'].value;
	hook = mail.indexOf('@');
	if(hook<=0){
		check = 1;
		alert("Receivers email address must contain '@'");
	} else {
		hook2 = mail.lastIndexOf('.');
		if(hook2<hook){
			check = 1;
			alert("Incorrect Receivers email address");
		}
	}
	
	return(check)
}


function fakeSubmit(){
    check = checkSubmit();
	
    if(check==0){
	setCookie("MC_wishes",document.forms[0].elements['dc.selectedItem.wishes'].value);
	setCookie("MC_from_name",document.forms[0].elements['dc.selectedItem.from_name'].value);
	setCookie("MC_from_mail",document.forms[0].elements['dc.selectedItem.from_mail'].value);
	setCookie("MC_to_name",document.forms[0].elements['dc.selectedItem.to_name'].value);
	setCookie("MC_to_mail",document.forms[0].elements['dc.selectedItem.to_mail'].value);

	wishes = document.forms[0].elements['dc.selectedItem.wishes'].value;

	if(navigator.appName=="Microsoft Internet Explorer"){

		wishes = wishes.replace(/\n/g,"<br>");
		wishes = encodeURI(wishes);
		query_string = "MADcards?PAGE=cards.preview&dc.category="
			+ document.forms[0].elements['dc.selectedItem.category'].value
			+ "&dc.card_id="
			+ document.forms[0].elements['dc.selectedItem.card_id'].value
			+ "&dc.wishes="
			+ wishes
			+ "&dc.from_name="
			+ encodeURI(document.forms[0].elements['dc.selectedItem.from_name'].value)
			+ "&dc.from_mail="
			+ document.forms[0].elements['dc.selectedItem.from_mail'].value
			+ "&dc.to_name="
			+ encodeURI(document.forms[0].elements['dc.selectedItem.to_name'].value)
			+ "&dc.to_mail="
			+ document.forms[0].elements['dc.selectedItem.to_mail'].value
			+ "&dc.selectedItem=null";
		document.location=query_string;
	}else{
		wishes = wishes.replace(/\n/g,"<br>");
		query_string = document.location.protocol+"//www.mad.com.pl/MADcards?PAGE=cards.preview&dc.category="
			+ document.forms[0].elements['dc.selectedItem.category'].value
			+ "&dc.card_id="
			+ document.forms[0].elements['dc.selectedItem.card_id'].value;
			qq=""
			+ "&dc.wishes="
			+ escape(wishes)
			+ "&dc.from_name="
			+ escape(document.forms[0].elements['dc.selectedItem.from_name'].value)
			+ "&dc.from_mail="
			+ escape(document.forms[0].elements['dc.selectedItem.from_mail'].value)
			+ "&dc.to_name="
			+ escape(document.forms[0].elements['dc.selectedItem.to_name'].value)
			+ "&dc.to_mail="
			+ escape(document.forms[0].elements['dc.selectedItem.to_mail'].value)
			+ "&dc.selectedItem=null";
/*
			+ escape(document.forms[0].elements['dc.selectedItem.category'].value)
			+ "&dc.card_id="
			+ escape(document.forms[0].elements['dc.selectedItem.card_id'].value)
			+ "&dc.wishes="
			+ escape(wishes)
			+ "&dc.from_name="
			+ escape(document.forms[0].elements['dc.selectedItem.from_name'].value)
			+ "&dc.from_mail="
			+ escape(document.forms[0].elements['dc.selectedItem.from_mail'].value)
			+ "&dc.to_name="
			+ escape(document.forms[0].elements['dc.selectedItem.to_name'].value)
			+ "&dc.to_mail="
			+ escape(document.forms[0].elements['dc.selectedItem.to_mail'].value)
			+ "&dc.selectedItem=null";
*/
			//alert(document.location);
			//alert(query_string+qq);
			//alert(escape(wishes));
		//document.location.href="http://www.mad.com.pl/MADforma?PAGE=www.home";
		location.replace(query_string+qq);
	}
    }
}

function ENfakeSubmit(){
    check = ENcheckSubmit();
	
    if(check==0){
	setCookie("MC_wishes",document.forms[0].elements['dc.selectedItem.wishes'].value);
	setCookie("MC_from_name",document.forms[0].elements['dc.selectedItem.from_name'].value);
	setCookie("MC_from_mail",document.forms[0].elements['dc.selectedItem.from_mail'].value);
	setCookie("MC_to_name",document.forms[0].elements['dc.selectedItem.to_name'].value);
	setCookie("MC_to_mail",document.forms[0].elements['dc.selectedItem.to_mail'].value);

	wishes = document.forms[0].elements['dc.selectedItem.wishes'].value;

	if(navigator.appName=="Microsoft Internet Explorer"){

		wishes = wishes.replace(/\n/g,"<br>");
		wishes = encodeURI(wishes);
		query_string = "MADcards?PAGE=en.cards.preview&dc.category="
			+ document.forms[0].elements['dc.selectedItem.category'].value
			+ "&dc.card_id="
			+ document.forms[0].elements['dc.selectedItem.card_id'].value
			+ "&dc.wishes="
			+ wishes
			+ "&dc.from_name="
			+ encodeURI(document.forms[0].elements['dc.selectedItem.from_name'].value)
			+ "&dc.from_mail="
			+ document.forms[0].elements['dc.selectedItem.from_mail'].value
			+ "&dc.to_name="
			+ encodeURI(document.forms[0].elements['dc.selectedItem.to_name'].value)
			+ "&dc.to_mail="
			+ document.forms[0].elements['dc.selectedItem.to_mail'].value
			+ "&dc.selectedItem=null";
	}else{
		wishes = wishes.replace(/\n/g,"<br>");
		query_string = "MADcards?PAGE=en.cards.preview&dc.category="
			+ escape(document.forms[0].elements['dc.selectedItem.category'].value)
			+ "&dc.card_id="
			+ escape(document.forms[0].elements['dc.selectedItem.card_id'].value)
			+ "&dc.wishes="
			+ escape(wishes)
			+ "&dc.from_name="
			+ escape(document.forms[0].elements['dc.selectedItem.from_name'].value)
			+ "&dc.from_mail="
			+ escape(document.forms[0].elements['dc.selectedItem.from_mail'].value)
			+ "&dc.to_name="
			+ escape(document.forms[0].elements['dc.selectedItem.to_name'].value)
			+ "&dc.to_mail="
			+ escape(document.forms[0].elements['dc.selectedItem.to_mail'].value)
			+ "&dc.selectedItem=null";
	}
	document.location=query_string;
    }
}

function realSubmit(gotoPage){
	check = checkSubmit();

	if(check==0){
		wishes = document.forms[0].elements['dc.selectedItem.wishes'].value;
		wishes = wishes.replace(/\n/g,"<br>");
		wishes = wishes.replace(/</g,"&lt;");
		wishes = wishes.replace(/>/g,"&gt;");
		wishes = wishes.replace(/\"/g,"&quot;");
		document.forms[0].elements['dc.selectedItem.wishes'].value = wishes;
		//gotoPage = gotoPage.replace(/&amp;/g,"&");
		save('newCard',gotoPage);
	}
}

function ENrealSubmit(gotoPage){
	check = ENcheckSubmit();

	if(check==0){
		wishes = document.forms[0].elements['dc.selectedItem.wishes'].value;
		wishes = wishes.replace(/\n/g,"<br>");
		wishes = wishes.replace(/</g,"&lt;");
		wishes = wishes.replace(/>/g,"&gt;");
		wishes = wishes.replace(/\"/g,"&quot;");
		document.forms[0].elements['dc.selectedItem.wishes'].value = wishes;
		//gotoPage = gotoPage.replace(/&amp;/g,"&");
		save('newCard',gotoPage);
	}
}


function initPortfolio(type){
	MM_preloadImages('img/btn_back_f2.gif','img/btn_more_f2.gif','img/btn_top_f2.gif');
	if(type == "category") document.forms[0].elements['dc.sort'][0].checked = 'y';
	if(type == "date") document.forms[0].elements['dc.sort'][1].checked = 'y';
	if(type == "industry") document.forms[0].elements['dc.sort'][2].checked = 'y';
	if(type == "topten") document.forms[0].elements['dc.sort'][3].checked = 'y';
	
}

function initExtranetPro(t, s){
	MM_preloadImages('img/btn_back_f2.gif','img/btn_more_f2.gif','img/btn_top_f2.gif');
}

function initExtranetMod(gotopage){
	formGotopage = document.forms[0].gotopage.value;
	
	if(formGotopage!="y"){
		//	Przejscie przez dziwne akcje
		exit("newTask_group",gotopage);
	} else {
		//	Przejscie prawidlowe
	}
}

//	Funkcje z japple
function save(formName,pageName,queryString,dProfile,dSession,targetframe) {
  var args = '';
  if( self.CoordinateHelper && self.CoordinateHelper.getSend() )
   {
       args += '&temp.window.x=' + self.CoordinateHelper.getX(); 
       args += '&temp.window.y=' + self.CoordinateHelper.getY();
   }

  if (dProfile) {
    args='sessionIDLocation='+dProfile;
  }

  if ( pageName )   
    queryString= queryString + '&PAGE=' + pageName;
    queryString= queryString.replace(/&amp;/g,"&");


  if ( dSession ) {
  	queryString=queryString+'&dataSession='+dSession;
  }
  if (targetframe) {
  	targetDoc=window.parent.frames[targetframe].document;
  } else {
  	targetDoc=document;
  }
  targetDoc.forms[formName].queryString.value='&executeService=japple.common.BasicSaveDataProfile('+args+')&'+queryString;
  targetDoc.forms[formName].submit();     
}

function saveAndExit(formName,pageName,queryString,dProfile,dSession,targetframe) {
var ie;
var args = '';
if(navigator){
  var agent= navigator.userAgent.toLowerCase();
  ie     = ((agent.indexOf("msie") != -1) && (agent.indexOf("opera") == -1));
  }else{
	  ie = true;
}

   if( self.CoordinateHelper && self.CoordinateHelper.getSend() )
   {
       args += '&temp.window.x=' + self.CoordinateHelper.getX(); 
       args += '&temp.window.y=' + self.CoordinateHelper.getY();
   }
  if (dProfile) {
    args='sessionIDLocation='+dProfile;
  }

  if ( pageName ){   
  	if(ie){
		queryString= '?PAGE=' + pageName + queryString ;
	}else{
		queryString=queryString + '&PAGE=' + pageName;
	}
  }
  if ( dSession) {
  	queryString=queryString+'&dataSession=useAndDiscard('+dSession+')';
  }
  if (targetframe) {
  	targetDoc=window.parent.frames[targetframe].document;
  } else {
  	targetDoc=document;
  }
 queryString= queryString.replace(/undefined/g,"");
 setCookie("MADformaLang",queryString);
 if(ie){
	 queryString= queryString.replace(/&amp;/g,"&");
	 queryString= queryString.replace(/undefined/g,"");
	 targetDoc.forms[formName].queryString.value=queryString+'&executeService=japple.common.BasicSaveAndDiscardDataProfile('+args+')';
 }else{


	targetDoc.forms[formName].queryString.value='&executeService=japple.common.BasicSaveAndDiscardDataProfile('+args+')&'+queryString;
 }
 
 
 targetDoc.forms[formName].submit();
 
}


function exit(formName,pageName,queryString,dProfile,dSession,targetframe) {
  var args = '';
   if( self.CoordinateHelper && self.CoordinateHelper.getSend() )
   {
       args += '&temp.window.x=' + self.CoordinateHelper.getX(); 
       args += '&temp.window.y=' + self.CoordinateHelper.getY();
   }
  if (dProfile ){
    args='sessionIDLocation='+dProfile;
  }


  
  if ( pageName )
    queryString=queryString + '&PAGE=' + pageName;
    queryString= queryString.replace(/&amp;/g,"&");

  if ( dSession ) {
  	queryString=queryString+'&dataSession=useAndDiscard('+dSession+')';
  }
  if (targetframe) {
  	targetDoc=window.parent.frames[targetframe].document;
  } else {
  	targetDoc=document;
  }
  
  if(formName=="newTask_group") targetDoc.forms[formName].gotopage.value='y';
  
  targetDoc.forms[formName].queryString.value='&executeService=japple.common.BasicDiscardDataProfile('+args+')&'+queryString;
  targetDoc.forms[formName].submit();
}

function deleteConfirm(formName,pageName,queryString,dProfile,dSession,targetframe) {
  if (confirm('Are you sure you want to delete this object?')){
    saveAndExit(formName,pageName,queryString,dProfile,dSession,targetframe);
  }
}
//	End of Japple functions


function extranetDeleteRedirect(to,from){
	setCookie("MADformaExtranetRedirect",from);
	document.location=to;
}

function extranetGoBack(){
	document.location = getCookie("MADformaExtranetRedirect");
	
}

function dialog_popup(args) {
	x = 0;
	x = getCookie("MADformaCounter");
	x++;
	setCookie("MADformaCounter",x);
	args=window.open(args,'MADformaDialogBox'+x,'status=yes,width=550,height=480');
}

function getEnv(){
/*
	var x;
	numPlugins = navigator.plugins.length;
	if (numPlugins <= 0)
		x = 'No Plugins Detected';
	else
		for (i = 0; i < numPlugins; i++)
	{
		plugin = navigator.plugins[i];
		x = ( x + plugin.name + '|*|*|' + plugin.description + '|*|*|');
	}
	if(getCookie("MADformaTracer")==""){
		setCookie("MADformaTracer",x);
*/		
		setCookie("MADformaReferrer",document.referrer);
/*		
		document.writeln('<script laguage="JavaScript1.2" src="MADforma?PAGE=www.log">');
	}
*/
}



 // szerokosc tabeli wynosi suma szerokosciposzczeg�lnych kolumn + liczba kolumn + 1
 // uzywane style: taskc7, twHdr - naglowek, tw0 i tw1 - wiersze tabelki
 // rowArray - tablica o dw�ch kolumnach tekstowych
 // colWidths - parameter opcjonalny
 function writeInfoTable(tableHdr, rowArray, colWidths, colAligns) {
  
  if (colWidths == null) {
   var colWidths = [420,68];
  }
  if (colAligns == null) {
   var colAligns = ["left","center"];
  }
  var innerTableWidth=0;
  for (var i=0; i<colWidths.length; i++) {
   innerTableWidth = innerTableWidth + colWidths[i]; 
  }
  innerTableWidth = innerTableWidth + colWidths.length - 1;
  var tableWidth = innerTableWidth + 2;
  
  document.write('<table cellspacing="0" cellpadding="0" width="'+tableWidth+'" border="0"><tr><td class="taskc7" width="'+tableWidth+'"><table cellspacing="0" cellpadding="0" width="'+innerTableWidth+'" border="0" align="center"><tr><td width="'+innerTableWidth+'" colspan="3"><img height="1" alt="" src="img/pix.gif" width="1"></td></tr><tr><td class="twHdr" width="'+(innerTableWidth-2)+'" colspan="3">');
  document.write(tableHdr);
  document.write('</td></tr>');
  
  if (rowArray != null) {
   for (var i=0; i<rowArray.length; i++) {
    document.write('<tr><td class="tw'+i%2+'" width="'+colWidths[0]+'" align="'+colAligns[0]+'">'+rowArray[i][0]+'</td>');
    document.write('<td width="1"><img height="1" alt="" src="img/pix.gif" width="1"></td>');
    document.write('<td class="tw'+i%2+'" width="'+colWidths[1]+'" align="'+colAligns[1]+'">'+rowArray[i][1]+'</td></tr>');
    document.write('<tr><td width="'+innerTableWidth+'" colspan="3"><img height="1" alt="" src="img/pix.gif" width="1"></td></tr>');
   }
  }
  document.write('</table></td></tr></table><br><br>');
 }

 function closeGame()  { 
 	close(); 
 }

 function showCardCoZeSwietami()  { 
	window.open('http://www.mad.com.pl/kartka/swieta_wariant_b.html','co_ze_swietami','fullscreen=yes,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no');
 }

 
function gemiusScripts(){
	protokol = /^https/i;
	if(protokol.test(window.location.href)){
		document.write('<script language="javascript1.2" type="text/javascript" src="https://www.mad.com.pl/gemius_sec.js"></script>');
	} else {
		document.write('<script language="javascript1.2" type="text/javascript" src="http://www.mad.com.pl/gemius.js"></script>');
	}
}
 
 
//-->
