//---- customizable variables (write to it via server variables) -------------
var popups_shown = 0;
var optionstyle = 3;
var imageIsLoaded = 0;
var waitresult;
var xmlHttp;
var requestType;
var popup_option = 1; //just added
//option values
// 1 = Slide up on page load and stay visible
// 2 = a) Slide up on page load
// b) Slide down after 10 seconds
// c) Slide up again after 5 seconds displaying a different model
// d) and stay visible
// 3 = a) Slide up on page load
// b) Slide down after 10 seconds,
// c) Slide up again after 5 seconds displaying a different model and report.
// d) Over and over
var modelid = "212167"; // ---> the model id
var affiliate_wid = "100127"; // --> the affiliate wid
var affiliate_cid = "100"; // --> the affiliate cid
var affiliate_rid = "1"; // --> the affiliate cid
var customer_name = "RihannaGrey"; // --> the customer name
var maintext = "Hi There!
How are you..."; // --> the fetched message from db
// ---- end of customizable variables -------------------
//---- normal variables ----------------------------------
var linkout="https://www.asians247.com/chat.php?model_id=" + modelid + "&context=free&wid=" +affiliate_wid + "&cid=" + affiliate_cid + "&rid=" + affiliate_rid;
var toptext="" + customer_name + " says,";
//---- end of customizeable variables
var csstext = ' ';
//var htmltext='
';
var htmltext='';
var ie = window.document.documentMode ? true : false;
var iebody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
document.write(csstext);
document.write(htmltext);
function txtTitle(){document.write(toptext);}
function txtMain(){document.write(''+maintext+'');}
function txtImg(){var randomnumber=Math.floor(Math.random()*50)+1;document.write('');}
function UpdateHTMLTexts() {
//to do:
linkout = "https://www.asians247.com/chat.php?model_id=" + modelid + "&context=free&wid=" +affiliate_wid + "&cid=" + affiliate_cid;
imageIsLoaded = 0;
//alert("BEFORE: " + document.getElementById("mainimg").src );
document.getElementById("mainimg").src = "https://imgs.cams247.com/gallery7/212167/tn1_profile.jpg";
popups_shown = popups_shown + 1;
document.getElementById("mainimg").onload = function imageLoaded() {
imageIsLoaded = 1;
}
//alert("AFTER: " + document.getElementById("mainimg").src );
document.getElementById("mainaimg").href = linkout;
document.getElementById("mainhref").href = linkout;
document.getElementById("mainhref").innerHTML = maintext;
document.getElementById("maingreeting").innerHTML = customer_name + " says,";
}
function createXMLHttpRequest() {
if(window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function startRequest( url, qry, type) {
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open(type, url, true);
if(type == 'POST') {
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
xmlHttp.send(qry);
} else {
xmlHttp.send(null);
}
}
function WaitForImg() {
if(imageIsLoaded==1) {
clearInterval(waitresult);
setTimeout("checkCookie()", 4000);
positionit();
}
}
function handleStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
//document.getElementById(div).innerHTML = xmlHttp.responseText;
//RESULT = xmlHttp.responseText
//alert(xmlHttp.responseText);
var reply = xmlHttp.responseText;
var sep_location = reply.indexOf("|");
var sep_location2 = reply.indexOf("|",sep_location+1);
modelid = reply.substring(0,sep_location);
customer_name = reply.substring(sep_location+1,sep_location2);
maintext = reply.substring(sep_location2+1);
//alert(modelid+" " +customer_name+" "+maintext);
imageIsLoaded = 0;
UpdateHTMLTexts();
waitresult = setInterval("WaitForImg()",100);
}
} else {
//document.getElementById(div).innerHTML = 'Loading...';
//request is loading.....
}
}
function RequestAnotherModel()
{
//qry = '&email=' + document.getElementById("email").value;
qry = "";
startRequest('requestmodel.php',qry,'POST');
}
function closethis()
{
var divPath = document.getElementById('floatyContent');
divPath.style.display='none';
}
function moveIt(id,x,state)
{
//values for state
//0 = moving up
//1 = on top
//2 = moving down
var supported = (document.getElementById);
if (!supported) {
//alert("Not suppoerted!");
return;
} else {
//alert("Supported!");
}
var divPath = document.getElementById(id);
var currPos = parseInt(divPath.style.bottom);
divPath.style.display='block';
if (currPos < x && state==0)
{
//alert("animating!");
currPos += 5;
divPath.style.bottom = currPos + "px";
setTimeout("moveIt('" + id + "'," + x + ",0)", 15);
} else if (state==2) {
//closing down
x = -150;
if(currPos >= x) {
currPos -= 5;
divPath.style.bottom = currPos + "px";
setTimeout("moveIt('" + id + "'," + x + ",2)", 15);
} else {
//must reload page here if option this option is on
//alert("-->"+document.getElementById('darkcastlemedia14344').src);
//document.getElementById('darkcastlemedia14344').src = document.getElementById('darkcastlemedia14344').src;
//alert("->"+self.src);
if(optionstyle==3) {
RequestAnotherModel();
} else {
if(popups_shown < 1) {
RequestAnotherModel();
}
}
}
} else if (optionstyle==2 || optionstyle==3){
if(optionstyle==2 && popups_shown==1) {
//ignore
} else {
timeout = 10000; //set timeout here for duration of flash
state=2; //flag for closing down animation
divPath.style.bottom = currPos + "px";
setTimeout("moveIt('" + id + "'," + x + ",2)", timeout);
}
}
}
function writePersistentCookie (CookieName, CookieValue, periodType, offset) {
var expireDate = new Date ();
offset = offset / 1;
var myPeriodType = periodType;
switch (myPeriodType.toLowerCase()) {
case "years":
var year = expireDate.getYear();
// Note some browsers give only the years since 1900, and some since 0.
if (year < 1000) year = year + 1900;
expireDate.setYear(year + offset);
break;
case "months":
expireDate.setMonth(expireDate.getMonth() + offset);
break;
case "days":
expireDate.setDate(expireDate.getDate() + offset);
break;
case "hours":
expireDate.setHours(expireDate.getHours() + offset);
break;
case "minutes":
expireDate.setMinutes(expireDate.getMinutes() + offset);
break;
default:
alert ("Invalid periodType parameter for writePersistentCookie()");
break;
}
document.cookie = escape(CookieName ) + "=" + escape(CookieValue) + "; expires=" + expireDate.toGMTString() + "; path=/";
}
function getCookieValue (cookieName) {
var exp = new RegExp (escape(cookieName) + "=([^;]+)");
if (exp.test (document.cookie + ";")) {
exp.exec (document.cookie + ";");
return unescape(RegExp.$1);
}
else return false;
}
function checkCookie()
{
counter = getCookieValue('msn_counter_132');
if(counter == false)
{
counter = 0;
}
else
{
counter = parseInt(counter);
}
if(counter < 1000000)
{
moveIt('floatyContent',-4,0);
writePersistentCookie ('msn_counter_132', counter+1, 'hours', 12);
}
}
function positionit(){
masterdivobj=document.getElementById("masterdiv")
var window_width=ie && !window.opera? iebody.clientWidth : window.innerWidth-20
window_height=ie && !window.opera? iebody.clientHeight : window.innerHeight
var dsocleft=ie? iebody.scrollLeft : pageXOffset
var masterdivwidth=masterdivobj.width
masterdivheight=masterdivobj.height
masterdivobj.style.left=(masterdivleft=="right")? window_width-masterdivwidth-20 : masterdivleft
setInterval("repositionit()", 100)
}
function repositionit(){
dsoctop=ie? iebody.scrollTop : pageYOffset
masterdivobj.style.top=(masterdivtop=="bottom")? window_height-masterdivheight-14+dsoctop : parseInt(masterdivtop)+dsoctop
}
window.onload = function(){
var randomnumber=Math.floor(Math.random()*60000)+1;
//alert(affiliate_wid + "," + affiliate_cid + " , " + 1000);
setTimeout("checkCookie()", 1000);
positionit();
//checkCookie()
};