/**
* phpmag ads beta 1.0
* Author Hatem <hatem@php.net>
*/

var w = window;
w.phpmag_ad_url = 'http://ads.phpmagazine.net/serve.php?dt=' + Math.round(Math.random() * 1000000)/1000000;
__addval('target',w.phpmag_target_path);
__addval('cid',w.phpmag_campaign_id);
__addval('kset',w.phpmag_keyword_set);
__addval('ftype',w.phpmag_format_type);
__addval('st8id',w.phpmag_partner_id);
__addval('associd',w.phpmag_associateid);

function __addval(key, value) {
	if (value) {
		w.phpmag_ad_url += '&' + key + '=' + value;
	}
}

function __addval_escaped(key, value) {
	w.phpmag_ad_url = w.phpmag_ad_url.replace(/ /, '');
	if (value) {
		w.phpmag_ad_url += '&' + key + '=' + escape(value);
	}
}

function __addquotes(value) {
  return (value != null) ? '"' + value + '"' : '""';
}

try {
	if (w.top.location != '') {
		__addval_escaped('ref',w.top.location);
	}
}
catch (e) {
	__addval_escaped('ref',w.location);
}

document.write('<scr' + 'ipt language="javascript" src=' + __addquotes(w.phpmag_ad_url) + '></scr' + 'ipt>');
