$(document).ready(function(){ var ref = parent.document.referrer; if(ref == "") { ref = "none"; } else { ref = ref.replace(/&/,"&"); } ajaxsend = getCookie("ajaxsend"); if(! ajaxsend) { setCookie("cntref",ref); uniq = uniqueID(); $.ajax({ type: "POST", url: myPath() + "id1_count.php", data: "r_name=" + ref + '&uniq=' + uniq, success: function(){ var nowtime = new Date().getTime(); expires = new Date(nowtime + (3600 * 1000)).toGMTString(); document.cookie = "ajaxsend=" + uniq + "; expires="+expires; } }); } }); function uniqueID(){ var randam = Math.floor(Math.random()*1000) var date = new Date(); var time = date.getTime(); return randam + time.toString(); } function myPath() { var scripts = document.getElementsByTagName("script"); var i = scripts.length; while (i--) { var match = scripts[i].src.match(/(^|.*\/)jqget\.js$/); if (match) { root = match[1]; break; } } return root; } function idFormSend(id) { if(typeof id === 'undefined') id = '#regfrm'; $form = (typeof id == 'object') ? $(id.form) : $(id); var parameter = $form.serialize(); parameter = parameter.replace(/&/g,"<>"); cntref = getCookie("cntref"); ajaxsend = getCookie("ajaxsend"); if(cntref == "") cntref = "none"; $.ajax({ type: "POST", url: myPath() + "id_count.php", data: "r_name=" + cntref + '&uniq=' + ajaxsend + "&fdata=" + parameter, }); return true; } function idLinkSend(id, parameter) { if(typeof id === 'undefined') id = '#maillink'; if(typeof parameter === 'undefined') { $form = $(id); var parameter = $form.attr('href'); } cntref = getCookie("cntref"); ajaxsend = getCookie("ajaxsend"); if(cntref == "") cntref = "none"; $.ajax({ type: "POST", url: myPath() + "id_count.php", data: "r_name=" + cntref + '&uniq=' + ajaxsend + "&fdata=" + parameter, }); return true; } function getCookie(key){ var tmp = document.cookie + ";"; var index1 = tmp.indexOf(key, 0); if(index1 != -1){ tmp = tmp.substring(index1,tmp.length); var index2 = tmp.indexOf("=",0) + 1; var index3 = tmp.indexOf(";",index2); return(unescape(tmp.substring(index2,index3))); } return false; } function setCookie(key, val){ document.cookie = key + "=" + escape(val) + ";"; }