// Associate-O-Matic v4.3.0

function popup(purl, pw, ph) {
	pww = pw + 30;
   	pwh = ph + 30;
	winpops = window.open('', 'imgWindow', 'width=' + pww + ',height=' + pwh);
   	winpops.document.write('<html><head><title></title></head><body style=\'cursor:pointer;\' onload=\'this.focus();\' onclick=\'window.close();\' onblur=\'window.close();\'><img alt=\'\' src=\'' + purl + '\' width=\'' + pw + '\' height=\'' + ph + '\'></body></html>');
	winpops.document.close();
}

function popupCond(msg) {
	winpops = window.open('', 'imgWindowTerms', 'width=300,height=300,resizable=1,scrollbars=yes') 
	winpops.document.write('<html><head><title></title></head><body onload=\'this.focus();\' onclick=\'window.close();\' onblur=\'window.close();\'>' + msg + '</body></html>');
	winpops.document.close();
}

function popupPricing(msg) {
	winpops = window.open('','imgWindowPricing','width=230,height=230,resizable=1,scrollbars=no') 
	winpops.document.write('<html><head><title></title></head><body onload=\'this.focus();\' onclick=\'window.close();\' onblur=\'window.close();\' style=\'cursor:pointer;\'><span class=\'aom_pdr\'>' + msg + '</span></body></html>')
	winpops.document.close();
}

function popupTerms(msg) {
	winpops = window.open('','imgWindowPricing','width=500,height=400,resizable=1,scrollbars=yes') 
	winpops.document.write('<html><head><title></title></head><body onload=\'this.focus();\' onclick=\'window.close();\' onblur=\'window.close();\' style=\'cursor:pointer;\'><span class=\'aom_pdr\'>' + msg + '</span></body></html>')
	winpops.document.close();
}

function checkVariation(msg) {
	var selection=document.Variation.elements['offerlistingid'].selectedIndex;
	if (selection=="-1") {
		alert(msg);
		document.Variation.elements['offerlistingid'].focus();
		return false;
	}
	return true;
}

function redirectSameWindow(msg) {
	if (document.Variation.elements['offerlistingid'].value != '') {
		window.open(document.Variation.elements['offerlistingid'].value, 'win');
	}
	else {
		alert(msg);
	}
}

function redirectNewWindow(msg) {
	if (document.Variation.elements['offerlistingid'].value != '') {
		location.href(document.Variation.elements['offerlistingid'].value);
	}
	else {
		alert(msg);
	}
}

function searchInside() {
	swn = document.getElementById('aom_swn').value;
	swk = document.getElementById('aom_swk').value;
	sbox = document.getElementById('aom_sbox').value;
	if (swk != sbox)
		searchinside = swk + ' ' + sbox;
	else
		searchinside = swk;
	document.getElementById('aom_sbox').value = searchinside;
	if (swn != '')
		document.getElementById('aom_swn').name = 'n';
	document.getElementById('aom_search').submit();
}

function displayDate(amz) {
	var t = new Date();
	var month = t.getMonth() + 1;
	var day = t.getDate();
	var year = t.getFullYear();
	
	if (amz=='Amazon.de' || amz=='Amazon.fr' || amz=='Amazon.co.uk') {
	
		month = String(month);
		day = String(day);
		if (month.length == 1)
			month = "0" + month;
		if (day.length == 1)
			day = "0" + day;
	}
	
	if (amz=='Amazon.de')
		document.write(day + '.' + month + '.' + year)
	else if (amz=='Amazon.co.uk' || amz=='Amazon.fr')
		document.write(day + '/' + month + '/' + year)
	else
		document.write(month + '/' + day + '/' + year)
}


