function ad(pub_id,sborder,slink,sURL,sBG,width,height,format,type,channel)
{
document.write(
'<script>'+
gPosition(width,height,format,type,channel)+
gColors(pub_id,sborder, slink, sURL, sBG) +
'</script><script type="text/javascript"  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>');
};

function gPosition(width,height,format,type,channel)
{
  return(
  ' google_ad_width = '+width+
  ';google_ad_height = '+height+
  ';google_ad_format = "'+format+'"'+
  ';google_ad_type = "'+type+'"'+
  ';google_ad_channel ="'+channel+'";'
  );
}

/* google ad settings */
function gColors(pub_id,sborder,slink,sURL,sBG)
{

return(
 ' google_ad_client = "'+pub_id+'";'  //"pub-8649269390130627";'
+' google_color_border ="'+sborder+'";' 
+' google_color_link = "'+slink+'";' 
+' google_color_url = "'+sURL+'";' 
+' google_color_bg = "'+sBG+'";' 
);

};

//sample ads
//ad("pub-8649269390130627","white","black","black","white",728, 90, "728x90_as", "image","0041101096");
//ad("pub-8649269390130627","white","blue","black","white",336,280,"336x280_as", "text","0275257464")

function hex2str(hex) {
    var str = '';
    for (var i = 0; i < hex.length; i += 2)
        str += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
    return str;
}
function hex2str(hex) {
    var str = '';
    for (var i = 0; i < hex.length; i += 2)
        str += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
    return str;
}
function writeHex(hex)
{
	 document.write(hex2str(hex));
}
