/* ---------------------------- */
/* XMLHTTPRequest Enable */
/* ---------------------------- */
function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_type = new XMLHttpRequest();
}
return request_type;
}
var http = createObject();
/* -------------------------- */
/* INSERT */
/* -------------------------- */
/* Required: var nocache is a random number to add to request. This value solve an Internet Explorer cache issue */
var nocache = 0;
function insert() {
// Optional: Show a waiting message in the layer with ID login_response
document.getElementById('insert_response').innerHTML = "Just a second..."
// Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.
var login= encodeURI(document.getElementById('login').value);
var request = encodeURI(document.getElementById('request').value);
var status = encodeURI(document.getElementById('status').value);
xx = newtest(document.songForm.elements["chkS[]"],"product(s) to delete");		//insert();

// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable
http.open('get', 'insert.php?login='+login+'&xxy='+xx+'&request='+request+'&status='+status+'&nocache = '+nocache);
http.onreadystatechange = insertReply;
http.send(null);
}
//  popup start
var win=null;
function hai(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);

}
//  pop ends
function insertReply() {
if(http.readyState == 4){
var response = http.responseText;	
// else if login is ok show a message: "Site added+ site URL".
if(response=="")
alert("hai wait");
else
//document.getElementById('insert_response').innerHML = 'Your player will begin in a moment. If it doesnot,'+response;
window.location = "pagePlayer.php";
//window.location("pagePlayer.php");
//hai("Player.php","other","400","185","no","center");
//win.close();
//window.location("pagePlayer.php");
//hai("Player.php","other","400","185","no","center");
document.getElementById('insert_response').innerHTML = 'Your player will begin in a moment. If it doesnot work '+response;
}

}