// Environment variables
var div_id = "div_jpgift";
var img_logo = "http://web2.jp.dk/quiz/quiz/images/tilbudslogo.png";
var img_separator = "http://jp.dk/img/jp/assets/gfx/x.gif";
var act_target = "http://bestil.jp.dk/Default.aspx";

// Browser variables
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

// Add JpGift elements
function AddJpGift()
{
    var div = document.getElementById(div_id);
    
	if (div != null)
	{
		div.innerHTML = "<form style='margin:0px;' action='" + act_target + "' method='post'>" +
						"<img align='right' src='" + img_logo + "'/>" +
						"<b>Få et godt tilbud </b>" +
						"<br/>" +
						"på Danmarks største avis." +
						"<br clear='all'/>" +
						"<div id='div_jpgift_separator'>" +
						"<img src='" + img_separator + "'/>" +
						"</div>" +
						"Indtast dit postnummer" +
						"<br/>" +
						"<br style='line-height: 3px;'/>" +
						"<input type='submit' id='btn_jpgift' name='btn_jpgift' value='OK'/>" +
						"<input type='text' class='jpgift_postnr' onfocus='CheckModeValue(this, 2);' value='Postnummer' onblur='CheckModeValue(this, 1);' name='postnr' id='postnr'/>" +
						"</form>";
	}
}
function CheckModeValue(pObj, pMode)
{
	if (pMode == 1)
	{
		if (pObj.value == "") pObj.value = "Postnummer"; 
	}
	else
	{
		if (pObj.value == "Postnummer") pObj.value = ""; 
	}
}
AddJpGift();
