// -------------------------------------------------------------------
// Image Thumbnail Viewer Script- By Dynamic Drive, available at: http://www.dynamicdrive.com
// Last updated: July 7th, 2008- Fixed enlarged image not showing in IE sometimes
// -------------------------------------------------------------------

var newsbox={
enableTitle: true, //Should "title" attribute of link be used as description?
enableAnimation: true, //Enable fading animation?
definefooter: '<div class="footerbar" onClick="newsbox.closeit()">X</div>', //Define HTML for footer interface
defineLoading: '<img src="'+websiteURL+'/imgs/loading.gif" width="17" /> Se incarca...', //Define HTML for "loading" div

/////////////No need to edit beyond here/////////////////////////

scrollbarwidth: 16,

createloginBox:function(){
//write out HTML for Image Thumbnail Viewer plus loading div
newsHTML = '<div style="text-align:left;background:#F1F1F1 url('+websiteURL+'images/form1.jpg);background-position:center top;background-repeat: no-repeat; width:500px; padding:140px 25px 15px 25px; font-family:Arial; font-size:13px;margin:0px auto;">\
<table border="0" cellpadding="0" cellspacing="0" width="500">\
	<tr>\
		<td height="70" valign="top"><span style="text-transform:uppercase; text-align: center;"> Inscrie-te la newsletter-ul nostru si vei putea descarca in urmatorul minut, in mod <strong>GRATUIT:</strong></span></td>\
	</tr>\
	<tr>\
		<td height="30" valign="top"><div style="font-size:19px; padding-left:20px; font-family:Times New Roman, Times, serif; color:#901e78;">GHIDUL KARENA 2010</div></td>\
	</tr>\
	<tr>\
		<td height="200" valign="middle"><ul style="color:#000; font-family:Times New Roman, Times, serif; font-size:16px;"><li>Cele mai frumoase <br /><strong>ROCHII DE MIREASA</strong></li><li>Cele mai naturale <strong> COAFURI</strong></li><li>Cei mai originali <strong>PANTOFI</strong></li><li>Cele mai elegante<strong>ACCESORII</strong></li></ul></td>\
	</tr>\
	<tr>\
		<td height="50" valign="top">\
			Completeaza campurile de mai jos cu prenumele tau,data nunti , judetul si adresa ta de e-mail si vei putea descarca chiar acum <span style="color:#901e78;">GHIDUL KANRENA 2010.</span>\
		</td>\
	</tr>\
</table>\
	<div id="pop ghid_err" style="color: #FF0000;"></div>\
	<form name="pop_ghid" method="post" action="http://www.aweber.com/scripts/addlead.pl"  style="padding:0;margin:0;" >\
		<input type="hidden" name="meta_web_form_id" value="200433423" />\
		<input type="hidden" name="meta_split_id" value="" />\
		<input type="hidden" name="listname" value="karena" />\
		<input type="hidden" name="redirect" value="http://www.karena.ro/newsletter_ok" id="redirect_6edb7e2bdd4f0c495d5441c149c676a3" />\
		<input type="hidden" name="meta_adtracking" value="Popup" />\
		<input type="hidden" name="meta_message" value="1" />\
		<input type="hidden" name="meta_required" value="custom Prenume,email,custom Luna,custom An,custom Zi,custom Judet" />\
		<input type="hidden" name="meta_forward_vars" value="" />\
		<input type="hidden" name="meta_tooltip" value="" />\
		<table width="338" border="0" align="center" cellpadding="0" cellspacing="5">\
			<tr>\
				<td width="103" >Prenume:</td>\
				<td width="261" colspan="3">\
					<input id="pop custom Prenume" name="custom Prenume" type="text" value=""   style=" width:98%" />\
				</td>\
			</tr>\
			<tr>\
				<td>Email:&nbsp;</td>\
				<td  colspan="3" ><input id="pop custom Email" name="email" type="text" value=""   style="width:98%;" />\
			</td>\
			</tr>\
		<tr>\
		<td>Data nuntii:</td>\
		<td >\
			<select id="pop custom Zi" name="Custom Zi" size="1" >\
				<option value="1">1</option>\
				<option value="2">2</option>\
				<option value="3">3</option>\
				<option value="4">4</option>\
				<option value="5">5</option>\
				<option value="6">6</option>\
				<option value="7">7</option>\
				<option value="8">8</option>\
				<option value="9">9</option>\
				<option value="10">10</option>\
				<option value="11">11</option>\
				<option value="12">12</option>\
				<option value="13">13</option>\
				<option value="14">14</option>\
				<option value="15">15</option>\
				<option value="16">16</option>\
				<option value="17">17</option>\
				<option value="18">18</option>\
				<option value="19">19</option>\
				<option value="20">20</option>\
				<option value="21">21</option>\
				<option value="22">22</option>\
				<option value="23">23</option>\
				<option value="24">24</option>\
				<option value="25">25</option>\
				<option value="26">26</option>\
				<option value="27">27</option>\
				<option value="28">28</option>\
				<option value="29">29</option>\
				<option value="30">30</option>\
				<option value="31">31</option>\
			</select>\
			</td>\
		<td>\
			<select id="pop custom Luna" name="custom Luna" size="1" style="width:110px;">\
				<option value="ianuarie">ianuarie</option>\
				<option value="februarie">februarie</option>\
				<option value="martie">martie</option>\
				<option value="aprilie">aprilie</option>\
				<option value="mai">mai</option>\
				<option value="iunie">iunie</option>\
				<option value="iulie">iulie</option>\
				<option value="august">august</option>\
				<option value="septembrie">septembrie</option>\
				<option value="octombrie">octombrie</option>\
				<option value="noiembrie">noiembrie</option>\
				<option value="decembrie">decembrie</option>\
			</select>\
			</td>\
			<td align="right">\
				<select id="pop custom An" name="Custom An" size="1" >\
					<option value="2010">2010</option>\
					<option value="2011">2011</option>\
					<option value="2012">2012</option>\
				</select>\
			</td>\
		</tr>\
		<tr>\
		  <td>Judet:</td>\
		  <td colspan="3">\
				<select id="pop custom Judet" name="custom Judet" style="width:100%;">\
					<option value="AB">Alba</option>\
					<option value="AG">Arges</option>\
					<option value="AR">Arad</option>\
					<option value="B" selected="selected" >Bucuresti</option>\
					<option value="BC">Bacau</option>\
					<option value="BH">Bihor</option>\
					<option value="BN">Bistrita</option>\
					<option value="BR">Braila</option>\
					<option value="BT">Botosani</option>\
					<option value="BV">Brasov</option>\
					<option value="BZ">Buzau</option>\
					<option value="CJ">Cluj</option>\
					<option value="CL">Calarasi</option>\
					<option value="CS">Caras-Severin</option>\
					<option value="CT">Constanta</option>\
					<option value="CV">Covasna</option>\
					<option value="DB">Dambovita</option>\
					<option value="DJ">Dolj</option>\
					<option value="GJ">Gorj</option>\
					<option value="GL">Galati</option>\
					<option value="GR">Giurgiu</option>\
					<option value="HD">Hunedoara</option>\
					<option value="HG">Harghita</option>\
					<option value="IF">Ilfov</option>\
					<option value="IL">Ialomita</option>\
					<option value="IS">Iasi</option>\
					<option value="MH">Mehedinti</option>\
					<option value="MM">Maramures</option>\
					<option value="MS">Mures</option>\
					<option value="NT">Neamt</option>\
					<option value="OT">Olt</option>\
					<option value="PH">Prahova</option>\
					<option value="SB">Sibiu</option>\
					<option value="SJ">Salaj</option>\
					<option value="SM">Satu-Mare</option>\
					<option value="SV">Suceava</option>\
					<option value="TL">Tulcea</option>\
					<option value="TM">Timis</option>\
					<option value="TR">Teleorman</option>\
					<option value="VL">Valcea</option>\
					<option value="VN">Vrancea</option>\
					<option value="VS">Vaslui</option>\
				</select>\
			</td>\
		</tr>\
		<tr>\
			<td colspan="4" align="center">\
				<br /><input type="image" src="'+websiteURL+'images/but.jpg" value="Submit" alt="Submit" onclick="return news_submit_ghid(\'pop \');"/><br /><br />\
			</td>\
		</tr>\
	</table>\
	<img src="http://forms.aweber.com/form/displays.htm?id=TAwMLMzMLEzM" border="0" />\
</form>\
</div>';
            
document.write('<div id="newsForm">'+this.definefooter+newsHTML+'</div>')
document.write('<div id="newsLoading">'+this.defineLoading+'</div>')
this.loginBox=document.getElementById("newsForm")
this.loginLoading=document.getElementById("newsLoading") //Reference "loading" div that will be shown while image is fetched
this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
},


centerDiv:function(divobj){ //Centers a div element on the page
var ie=document.all && !window.opera
var dom=document.getElementById
var scroll_top=(ie)? this.standardbody.scrollTop : window.pageYOffset
var scroll_left=(ie)? this.standardbody.scrollLeft : window.pageXOffset
var docwidth=(ie)? this.standardbody.clientWidth : window.innerWidth-this.scrollbarwidth
var docheight=(ie)? this.standardbody.clientHeight: window.innerHeight
var docheightcomplete=(this.standardbody.offsetHeight>this.standardbody.scrollHeight)? this.standardbody.offsetHeight : this.standardbody.scrollHeight //Full scroll height of document
var objwidth=divobj.offsetWidth //width of div element
var objheight=divobj.offsetHeight //height of div element
var topposition=(docheight>objheight)? scroll_top+docheight/2-objheight/2+"px" : scroll_top+10+"px" //Vertical position of div element: Either centered, or if element height larger than viewpoint height, 10px from top of viewpoint
divobj.style.left=docwidth/2-objwidth/2+"px" //Center div element horizontally
divobj.style.top=Math.floor(parseInt(topposition))+"px"
divobj.style.visibility="visible"
},

showloginBox:function(){ //Show ThumbBox div
newsbox.loginLoading.style.visibility="hidden" //Hide "loading" div
this.centerDiv(this.loginBox)
//document.getElementById('login_user2').focus();
},


loadimage:function(link){ //Load image function that gets attached to each link on the page with rel="thumbnail"
if (this.loginBox.style.visibility=="visible") //if thumbox is visible on the page already
this.closeit() //Hide it first (not doing so causes triggers some positioning bug in Firefox
this.centerDiv(this.loginLoading) //Center and display "loading" div while we set up the image to be shown
setTimeout("newsbox.showloginBox()",1000);
},

closeit:function(){ //Close "thumbbox" div function
this.loginBox.style.visibility="hidden"
this.loginBox.style.left="-2000px"
this.loginBox.style.top="-2000px"
},

cleanup:function(){ //Clean up routine on page unload
this.loginLoading=null
this.loginBox=null
},

dotask:function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
if (target.addEventListener)
target.addEventListener(tasktype, functionref, false)
else if (target.attachEvent)
target.attachEvent(tasktype, functionref)
}

}

newsbox.createloginBox() //Output HTML for the image thumbnail viewer
newsbox.dotask(window, function(){newsbox.cleanup()}, "unload")


    function news_submit_ghid(prefix)
    {
        err = '';
        
        if(!document.getElementById(prefix+'custom Prenume').value.length)
            err += 'Introdu prenumele.<br/>';    
        if(!document.getElementById(prefix+'custom Email').value.length)
            err += 'Introdu adresa de e-mail.<br/>';
        else
        {
            _email = /^[A-Z0-9._%\-\']+@[A-Z0-9.-]+\.[A-Z]{2,6}$/i;
            if(!(_email.exec(document.getElementById(prefix+'custom Email').value)))
                err += 'Introdu o adresa de e-mail valida.<br/>';
        }
        
        if(!document.getElementById(prefix+'custom Luna').value.length)
            err += 'Introdu luna nuntii.<br/>';
        if(!document.getElementById(prefix+'custom An').value.length)
            err += 'Introdu anul nuntii.<br/>';
        
        if(err.length)
        {
            document.getElementById(prefix+'ghid_err').innerHTML = err;
            return false;
        }
        else
            if(prefix.length)
                document.pop_ghid.submit();
            else
                document.box_ghid.submit();
    }
