
// JavaScript Document

var http_check 	= (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");

var CONTENTDIV	= "content";

var SCREENHEIGHT= screen.availHeight;//screen.availHeight;

var SCREENWIDTH = screen.width;

var x = 0;

var y = 0;





var nVer = navigator.appVersion;

var nAgt = navigator.userAgent;

var browserName  = '';

var fullVersion  = 0;

var majorVersion = 0;



// In Internet Explorer, the true version is after "MSIE" in userAgent

if ((verOffset=nAgt.indexOf("MSIE"))!=-1) {

	browserName  = "IE";

	fullVersion  = parseFloat(nAgt.substring(verOffset+5));

	majorVersion = parseInt(''+fullVersion);

}



// In Opera, the true version is after "Opera"

else if ((verOffset=nAgt.indexOf("Opera"))!=-1) {

	browserName  = "Opera";

	fullVersion  = parseFloat(nAgt.substring(verOffset+6));

	majorVersion = parseInt(''+fullVersion);

}



// In Firefox, the true version is after "Firefox" 

else if ((verOffset=nAgt.indexOf("Firefox"))!=-1) {

	browserName  = "Firefox";

	fullVersion  = parseFloat(nAgt.substring(verOffset+8));

	majorVersion = parseInt(''+fullVersion);

}



// In most other browsers, "name/version" is at the end of userAgent 

else if ( (nameOffset=nAgt.lastIndexOf(' ')+1) < (verOffset=nAgt.lastIndexOf('/')) ) 

{

	browserName  = nAgt.substring(nameOffset,verOffset);

	fullVersion  = parseFloat(nAgt.substring(verOffset+1));

	if (!isNaN(fullVersion)) majorVersion = parseInt(''+fullVersion);

	else {fullVersion  = 0; majorVersion = 0;}

}



// Finally, if no name and/or no version detected from userAgent...

if (browserName.toLowerCase() == browserName.toUpperCase()

 || fullVersion==0 || majorVersion == 0 )

{

	browserName  = navigator.appName;

	fullVersion  = parseFloat(nVer);

	majorVersion = parseInt(nVer);

}

	

function coordinates(event){

	x = 0;

	y = 0;

	x = event.screenX;

	y = event.screenY;

	//alert('X: '+x+' || Y: '+y);

}



///////////////////////////////////////////////////////////////

// calculate the current window width //

function pageWidth() {

	return window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;

}



// calculate the current window height //

function pageHeight() {

	return window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;

}



// calculate the current window vertical offset //

function topPosition() {

	return typeof window.pageYOffset != 'undefined' ? window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;

}



// calculate the position starting at the left of the window //

function leftPosition() {

	return typeof window.pageXOffset != 'undefined' ? window.pageXOffset : document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;

}

////////////////////////////////////////////////////////////////





// JavaScript Document

var persistclose=0

var startX = '';

var startY = 5

var verticalpos="frombottom" //enter "fromtop" or "frombottom"



function iecompattest(){

	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body

}



function get_cookie(Name) {

	var search = Name + "="

	var returnvalue = "";

	if (document.cookie.length > 0) {

		offset = document.cookie.indexOf(search)

	if (offset != -1) {

		offset += search.length

		end = document.cookie.indexOf(";", offset);

		if (end == -1) end = document.cookie.length;

			returnvalue=unescape(document.cookie.substring(offset, end))

		}

	}

	return returnvalue;

}





//+++++++++  This function return the page height and width start here ++++++++++++++++++++//

function getPageSize(){

	

	var xScroll, yScroll;

	

	if (window.innerHeight && window.scrollMaxY) {	

		xScroll = document.body.scrollWidth;

		yScroll = window.innerHeight + window.scrollMaxY;

	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac

		xScroll = document.body.scrollWidth;

		yScroll = document.body.scrollHeight;

	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari

		xScroll = document.body.offsetWidth;

		yScroll = document.body.offsetHeight;

	}

	

	var windowWidth, windowHeight;

	if (self.innerHeight) {	// all except Explorer

		windowWidth = self.innerWidth;

		windowHeight = self.innerHeight;

	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode

		windowWidth = document.documentElement.clientWidth;

		windowHeight = document.documentElement.clientHeight;

	} else if (document.body) { // other Explorers

		windowWidth = document.body.clientWidth;

		windowHeight = document.body.clientHeight;

	}	

	

	// for small pages with total height less then height of the viewport

	if(yScroll < windowHeight){

		pageHeight = windowHeight;

	} else { 

		pageHeight = yScroll;

	}

	

	// for small pages with total width less then width of the viewport

	if(xScroll < windowWidth){	

		pageWidth = windowWidth;

	} else {

		pageWidth = xScroll;

	}

	

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 

	return arrayPageSize;

}

//+++++++++  This function return the page height and width end here ++++++++++++++++++++//
function checkNewCaptcha(value){
	var url = "check_captcha.php?code="+ value;
	http_check.open("GET", url, true);				
	http_check.onreadystatechange = function test(){	
		if(http_check.readyState == 4) {							
			var response = http_check.responseText; 
			if (response =='yes'){
					return true;
				}else{
					return false;
				}
			
		}
	}	
	http_check.send(null);
}	








function chat_bar(stDivId){

		

	barheight=document.getElementById(stDivId).offsetHeight

	var ns = (navigator.appName.indexOf("Netscape") != -1) || window.opera;

	var d = document;

	

	function ml(id){

		var el=d.getElementById(id);

		if (!persistclose || persistclose && get_cookie("remainclosed")=="")

		el.style.visibility="visible"

		if(d.layers)el.style=el;

		el.sP=function(x,y){this.style.left=x+"px";this.style.top=y+"px";};

		el.x = startX;

		if (verticalpos=="fromtop")

			el.y = startY;

		else{

			el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;

			el.y -= startY;

		}

		return el;

	}

	window.stayTopLeft=function(){

		if (verticalpos=="fromtop"){

			var pY = ns ? pageYOffset : iecompattest().scrollTop;

			ftlObj.y += (pY + startY - ftlObj.y)/8;

		}

		else{

			var pY = ns ? pageYOffset + innerHeight - barheight: iecompattest().scrollTop + iecompattest().clientHeight - barheight;

			ftlObj.y += (pY - startY - ftlObj.y)/8;

		}

		ftlObj.sP(ftlObj.x, ftlObj.y);

		setTimeout("stayTopLeft()", 10);

	}

	ftlObj = ml(stDivId);

	stayTopLeft();

}


function showTunaBalloon(divId){	
	//alert(divId);
	

	

	var pageDet = getPageSize();

	

	var pagWid = pageDet[0];

	var pagHei = pageDet[1];

	var winWid = pageDet[2];

	var winHei = pageDet[3];		

	

	var popUpWidth 		= $(divId).getWidth();

	var popUpHeight		= $(divId).getHeight();

		

	var topposition 	= (winHei / 2) - (popUpHeight / 2);

	var leftposition 	= (winWid / 2) - (popUpWidth / 2);

		

	$(divId).show();
	document.getElementById("maskBalloon").style.height = pagHei+"px";

	document.getElementById("maskBalloon").style.width  = pagWid+"px";

	$("div_balloon").show();

	

	JSFX_FloatDiv(divId,leftposition,topposition).floatIt();

	return false;

}



/////////////////////////////////////////////////////////////////



function showHelp(divId,relativeDivId){	
 
$("reEmailErr").innerHTML = '';
var obj 		= document.getElementById(divId);
var relObj		= document.getElementById(relativeDivId);
var divPos 		= GetLeftTopPosition(relObj);
var posBody 	= divPos.split('::');
var divLeft 	= parseInt(posBody[0]);
var divTop 		= parseInt(posBody[1]);
var openDivLeft = (divLeft+100);
var openDivTop 	= (divTop+70);
obj.style.top 	  = openDivTop+'px';
obj.style.left 	  = openDivLeft+'px';
//obj.style.display 	= 'block';
$j("#"+divId).fadeIn(2000);
var det = getPageSize();
cntWidth = det[0];
cntHeight= det[1];
document.getElementById("maskDivMedia").style.height = cntHeight+"px";
document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	
//document.getElementById("div_loading").style.display = 'block';	
$j("#div_loading").fadeIn(2000);
return false;

}


//////////////function for browser version message start here///////////
function showBrowserPopup(divId,relativeDivId){	
var obj 		= document.getElementById(divId);
var relObj		= document.getElementById(relativeDivId);
var divPos 		= GetLeftTopPosition(relObj);
var posBody 	= divPos.split('::');
var divLeft 	= parseInt(posBody[0]);
var divTop 		= parseInt(posBody[1]);
var openDivLeft = (divLeft+200);
var openDivTop 	= (divTop+50);
obj.style.top 	  = openDivTop+'px';
obj.style.left 	  = openDivLeft+'px';
$j("#"+divId).fadeIn(2000);
var det = getPageSize();
cntWidth = det[0];
cntHeight= det[1];
document.getElementById("maskDivMedia").style.height = cntHeight+"px";
document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	
//document.getElementById("div_loading").style.display = 'block';	
$j("#div_loading").fadeIn(2000);
return false;

}
function closeBrowserMsgBox(divId){
	$j("#"+divId).fadeOut(2000);
	$j("#div_loading").fadeOut(2000);
	document.getElementById("div_loading").style.display = 'none';
}
//////////////function for browser version message ends here///////////

////////////////function for send activation link start here////////////////////////////////////



function sendLink(){
 	var email	= $("reuseremail").value;	
 	email		= rm_trim(email);
 	var errCnt	= 0;
 	var errMsg	= "All fields are required.";
 	if(email == ''){
 		errCnt++;
 	}
 	if(errCnt > 0){
 		$("reEmailErr").innerHTML = errMsg;
 		return false;
 	}else{
 		if( isEmail(email) == true){
          var check      = document.getElementById("checklink").value;
			if(check == '')
			{
			document.getElementById("reEmailErr").innerHTML ='All fields are required';
			return false;
			}
 			var url = "resend-link.php?eid="+email+"&code="+check;
 			//alert(url);
 			new Ajax.Request(url, {
 				method:'get',
 				onSuccess: function(transport){
 					var response = transport.responseText || ".....";
 					//alert("Success! :: " + response);
 					if (response == 2){
						document.getElementById("reEmailErr").innerHTML ='Invalid code, try again.';
						return false;
					}else if (response == 1){						
 						$("reuseremail").value	= '';
 						mess = 'Check your email.';
 						$("reEmailErr").innerHTML = mess;
						 document.getElementById("checklink").value='';
 					}
 					else if(response == 3){
 						$("reuseremail").value	= '';
 						mess = 'Email is not registered';						
 						$("reEmailErr").innerHTML = mess;						
 					}else{
 						$("reuseremail").disabled = false;
 						$("FRG_BTNRL_ID").disabled = false;
 						mess = 'Your input does not match. Re-enter!';						
 						$("reEmailErr").innerHTML = mess;						
 					}
  				},
 				onCreate: function(transport){
 					//alert('ajax started');
 				},
 				onException: function(){
 					//alert('onException.. fan resend link...');
 				},
 				onFailure: function(){
 					//alert('onFailure.. fan resend link...');
 				}

			});	
  
		}else{
 			$("reEmailErr").innerHTML = "Email is incorrect.";
 			return false;
 		}

	}
 
}



//////////////////function for send activation link ends here//////////////////////////////////



function resendLink(){
 	var email	= $("reuseremail").value;
 	email		= rm_trim(email);
  	var errCnt	= 0;
 	var errMsg	= "Enter your email.";
 	if(email == ''){
 		errCnt++;
 	}
 	if(errCnt > 0){
 		$("reEmailErr").innerHTML = errMsg;
 		return false;
 	}else{
 		if( isEmail(email) == true){
 			$("reEmailErr").innerHTML = "wait...";
 			$("reuseremail").disabled = true;
 			$("RE_FRG_BTN_ID").disabled = true;			
 			var url = "resend-link.php?eid="+email;
 			//alert(url);
 			new Ajax.Request(url, {
 				method:'get',
 				onSuccess: function(transport){
 					var response = transport.responseText || ".....";
 					//alert("Success! :: " + response);
					

			
		if (response == 'success')

					{						

						

						$("reuseremail").value	= '';

						$("reuseremail").disabled = false;

						$("RE_FRG_BTN_ID").disabled = false;

						

						

						mess = 'Check your mail box.';

						$("reEmailErr").innerHTML = mess;

						

						//$(divId).hide();

						//$("div_loading").hide();

						

					}

					else if(response == 'fail')

					{

						$("reuseremail").value	= '';

						mess = 'Try again, after some time.';						

						$("reEmailErr").innerHTML = mess;						

					}

					else

					{

						$("reuseremail").disabled = false;

						$("RE_FRG_BTN_ID").disabled = false;

						mess = 'Your input does not match.re-enter!';						

						$("reEmailErr").innerHTML = mess;						

					}

					

				},

				onCreate: function(transport){

					//alert('ajax started');

				},

				onException: function(){

					//alert('onException.. fan resend link...');

				},

				onFailure: function(){

					//alert('onFailure.. fan resend link...');

				}

			});	

			

		}

		else

		{

			$("reEmailErr").innerHTML = "Email is incorrect.";

			return false;

		}

	}

	

}



////////////////////////////////////////////////////

function showHelpregis(){	

	

	var obj = document.getElementById("showHelpId");

	obj.style.display = 'block';

	document.getElementById("country").disabled = true;

	//document.getElementById("question").disabled = true;

	

	document.getElementById("reEmailErr").innerHTML = '';

	

	var width 			= pageWidth();	

	var height 			= pageHeight();	

	var left 			= leftPosition(); 

	var top 			= topPosition();

	var dialogwidth 	= obj.offsetWidth;

	var dialogheight 	= obj.offsetHeight;

	var topposition 	= top + (height / 2) - (dialogheight / 2);

	var leftposition 	= left + (width / 2) - (dialogwidth / 2);

	obj.style.top 		= topposition + "px";

	obj.style.left 		= leftposition + "px";

	

	var cntObj 	  		= document.getElementById(CONTENTDIV);

	var cntHeight 		= cntObj.offsetHeight;

	var cntWidth		= cntObj.offsetWidth;

		

	if(SCREENHEIGHT == '994'){

		

		if(cntHeight < 1000 && cntHeight > 950){

			cntHeight = SCREENHEIGHT - 10;	

		}else if(cntHeight > 1000){

			cntHeight = cntHeight;

		}else{

			cntHeight = SCREENHEIGHT - 140;

		}

	}else if(SCREENHEIGHT == '738'){

		

		if(cntHeight > 700  && cntHeight < 750){			

			cntHeight = SCREENHEIGHT;

		}else if(cntHeight > 750 ){			

			cntHeight = cntHeight;

		}else if(cntHeight < SCREENHEIGHT){

			cntHeight = SCREENHEIGHT - 140;

		}else{			

			cntHeight = SCREENHEIGHT;

		}

	}

	

	document.getElementById("maskDivMedia").style.height = cntHeight+"px";

	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";

	

	document.getElementById("div_loading").style.display = 'block';

	var float_left = (SCREENWIDTH / 2) - 120;

	var float_top  = (SCREENHEIGHT / 3) - 120;

	JSFX_FloatDiv('showHelpId', float_left,float_top).floatIt();

	return false;

}

///////////////////////////////////////////////////



function showVal(divId,relativeDivId){			
   	$("foPassErr").innerHTML = '';	
  	var obj 		  	= document.getElementById(divId);
 	var relObj		= document.getElementById(relativeDivId);
	var divPos 		= GetLeftTopPosition(relObj);
 	var posBody 	= divPos.split('::');
	var divLeft 	= parseInt(posBody[0]);
	var divTop 		= parseInt(posBody[1]);
	var openDivLeft = (divLeft+50);
	var openDivTop 	= (divTop+70);
	obj.style.top 	  = openDivTop+'px';
	obj.style.left 	  = openDivLeft+'px';
	//obj.style.display 	= 'block';
 	$j("#"+divId).fadeIn(2000);
 	var det = getPageSize();
	cntWidth = det[0];
	cntHeight= det[1];
	document.getElementById("maskDivMedia").style.height = cntHeight+"px";
	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	
	//document.getElementById("div_loading").style.display = 'block';	
	$j("#div_loading").fadeIn(2000);
	return false;
 }

 

function sendPassword(){
 	var email	= $("foremail").value;	
 	email		= rm_trim(email);
 	var errCnt	= 0;
 	var errMsg	= "All fields are required.";
 	if(email == ''){
 		errCnt++;
 	}
  	if(errCnt > 0){
 		$("foPassErr").innerHTML = errMsg;
 		return false;
 	}
 	else{
 		if( isEmail(email) == true){
			var check      = document.getElementById("checkpassword").value;
		if(check == '')
		{
			document.getElementById("foPassErr").innerHTML ='All fields are required';
			return false;
		}
		var url = "forgot-paasword.php?fid="+email+"&code="+check;
 			// alert(url);
 			new Ajax.Request(url, {
 				method:'get',
 				onSuccess: function(transport){
 					var response = transport.responseText || ".....";
 					 //alert("Success! :: " + response);
                    if (response == 2) {	
					 	document.getElementById("foPassErr").innerHTML ='Invalid code, try again.';
						return false;
					}
					else if (response == 1) {	
					 	$("foremail").value	= '';
						 mess = 'Check your email';
						$("foPassErr").innerHTML = mess;
						document.getElementById("checkpassword").value='';
					}
					else if(response == 3){
						$("foremail").value	= '';
						mess = 'Email is not registered';						
						$("foPassErr").innerHTML = mess;						
					}
					else{
						$("foremail").disabled = false;
						$("FRG_BTN_ID").disabled = false;
						mess = 'Your input does not match. Re-enter!';						
						$("foPassErr").innerHTML = mess;						
					}
				},
				onCreate: function(transport){
					//alert('ajax started');
				},
				onException: function(){
					//alert('onException.. fan forgot password...');
				},
				onFailure: function(){
					//alert('onFailure.. fan forgot password...');
				}
			});	
		}
		else
		{
			$("foPassErr").innerHTML = "Email is incorrect.";
			return false;
		}

	}

}





////////////////////////////////////////////

function showValRegis(){

	//alert();

	var obj = document.getElementById("showValId");

	obj.style.display = 'block';

	document.getElementById("country").disabled = true;

	

	//document.getElementById("question").disabled = true;

	document.getElementById("foPassErr").innerHTML = '';

		

	var width 			= pageWidth();	

	var height 			= pageHeight();	

	var left 			= leftPosition(); 

	var top 			= topPosition();

	var dialogwidth 	= obj.offsetWidth;

	var dialogheight 	= obj.offsetHeight;

	var topposition 	= top + (height / 2) - (dialogheight / 2);

	var leftposition 	= left + (width / 2) - (dialogwidth / 2);

	obj.style.top 		= topposition + "px";

	obj.style.left 		= leftposition + "px";

	

	var cntObj 	  		= document.getElementById(CONTENTDIV);

	var cntHeight 		= cntObj.offsetHeight;

	var cntWidth		= cntObj.offsetWidth;

	

	if(SCREENHEIGHT == '994'){

		

		if(cntHeight < 1000 && cntHeight > 950){

			cntHeight = SCREENHEIGHT - 10;	

		}else if(cntHeight > 1000){

			cntHeight = cntHeight;

		}else{

			cntHeight = SCREENHEIGHT - 140;

		}

	}else if(SCREENHEIGHT == '738'){

		

		if(cntHeight > 700  && cntHeight < 750){			

			cntHeight = SCREENHEIGHT;

		}else if(cntHeight > 750 ){			

			cntHeight = cntHeight;

		}else if(cntHeight < SCREENHEIGHT){

			cntHeight = SCREENHEIGHT - 140;

		}else{			

			cntHeight = SCREENHEIGHT;

		}

	}

	

	document.getElementById("maskDivMedia").style.height = cntHeight+"px";

	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	

	document.getElementById("div_loading").style.display = 'block';

	var float_left = (SCREENWIDTH / 2) - 120;

	var float_top  = (SCREENHEIGHT / 3) - 120;

	JSFX_FloatDiv('showValId', float_left,float_top).floatIt();

	return false;

}

////////////////////////////////////////////





function showFeedback(divId)

{

	

	

	var pageDet = getPageSize();

	

	var pagWid = pageDet[0];

	var pagHei = pageDet[1];

	var winWid = pageDet[2];

	var winHei = pageDet[3];

		

	

	var popUpWidth 		= $(divId).getWidth();

	var popUpHeight		= $(divId).getHeight();

			

	var topposition 	= (winHei / 2) - (popUpHeight / 2);

	var leftposition 	= (winWid / 2) - (popUpWidth / 2);

	

	$("ustname").value= '';

	$("ustemail").value= '';

	$("usrFeed").value= '';

	$("feedErr").innerHTML= '';

	$("leftchar").innerHTML= "1000";

			

	$(divId).show();

			

	$("maskDivMedia").style.height = pagHei+"px";

	$("maskDivMedia").style.width  = pagWid+"px";

	

	$("div_loading").show();

	

	JSFX_FloatDiv(divId,leftposition,topposition).floatIt();

	return false;

}





function sendFeedback()

{

	var errCnt = 0;

	var email	= $("ustemail").value;	

	email		= rm_trim(email);

	var name	= $("ustname").value;

	name		= rm_trim(name);

	var feed	= $("usrFeed").value;

	feed		= rm_trim(feed);

	

	if(name == ''){

		errCnt++;

	}

	if(feed == ''){

		errCnt++;

	}

	if(email == ''){

		errCnt++;

	}

	

	

	var errMsg	= "*All fields are required.";

	

	if(errCnt > 0){

		$("feedErr").innerHTML = errMsg;

		return false;

	}

	else

	{

		

		if( isEmail(email) == true)

		{

						

			$("feedErr").innerHTML = "wait...";

			$("FEEDBCK_BTN_ID").disabled = true;

			

			var url = "forgot-paasword.php?email="+email+"&name="+name+"&feed="+feed;

			//alert(url);

			new Ajax.Request(url, {

				method:'get',

				onSuccess: function(transport){

					var response = transport.responseText || ".....";

					//alert("Success! :: " + response);

					

					if (response == 'success')

					{						

						

						$("ustemail").value	= '';

						$("ustname").value	= '';

						$("usrFeed").value	= '';

						

						$("FEEDBCK_BTN_ID").disabled = false;

						

						mess = 'Thanks for feedback.';

						$("feedErr").innerHTML = mess;

						

						//$(divId).hide();

						//$("div_loading").hide();

						

					}

					else if(response == 'fail')

					{						

						mess = 'Try again, after some time.';				

						$("feedErr").innerHTML = mess;						

					}

					else

					{

						mess = 'ERROR';				

						$("feedErr").innerHTML = mess;

					}

					

				},

				onCreate: function(transport){

					//alert('ajax started');

				},

				onException: function(){

					//alert('onException.. feed back...');

				},

				onFailure: function(){

					//alert('onFailure.. feed back...');

				}

			});	

			

		}

		else

		{

			$("feedErr").innerHTML = "Email is incorrect.";

			return false;

		}

	}

	

	

}





////////////////////////////////////////////

////////////////////////////////////////////

function showFeedbackInner(){

	//alert();

	document.getElementById("ustname").value= '';

	document.getElementById("ustemail").value= '';

	document.getElementById("usrFeed").value= '';

	document.getElementById("feedErr").innerHTML= '';

	document.getElementById("leftchar").innerHTML= "1000";

	

	var obj = document.getElementById("feedback");

	obj.style.display = 'block';

	

	

	var selObj = document.getElementsByTagName('select');	

	for(i=0; i<selObj.length; i++){

		var selId = selObj[i].id;	

		document.getElementById(selId).style.visibility = 'hidden';

	}	

	

		

	var width 			= pageWidth();	

	var height 			= pageHeight();	

	var left 			= leftPosition(); 

	var top 			= topPosition();

	var dialogwidth 	= obj.offsetWidth;

	var dialogheight 	= obj.offsetHeight;

	var topposition 	= top + (height / 2) - (dialogheight / 2);

	var leftposition 	= left + (width / 2) - (dialogwidth / 2);

	obj.style.top 		= topposition + "px";

	obj.style.left 		= leftposition + "px";

	

	var cntObj 	  		= document.getElementById(CONTENTDIV);

	var cntHeight 		= cntObj.offsetHeight;

	var cntWidth		= cntObj.offsetWidth;

	

	if(SCREENHEIGHT == '994'){

		

		if(cntHeight < 1000 && cntHeight > 950){

			cntHeight = SCREENHEIGHT - 10;	

		}else if(cntHeight > 1000){

			cntHeight = cntHeight;

		}else{

			cntHeight = SCREENHEIGHT - 140;

		}

	}else if(SCREENHEIGHT == '738'){

		

		if(cntHeight > 700  && cntHeight < 750){			

			cntHeight = SCREENHEIGHT;

		}else if(cntHeight > 750 ){			

			cntHeight = cntHeight;

		}else if(cntHeight < SCREENHEIGHT){

			cntHeight = SCREENHEIGHT - 140;

		}else{			

			cntHeight = SCREENHEIGHT;

		}

	}

	

	document.getElementById("maskDivMedia").style.height = cntHeight+"px";

	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	

	document.getElementById("div_loading").style.display = 'block';

	var float_left = (SCREENWIDTH / 2) - 120;

	var float_top  = (SCREENHEIGHT / 3) - 120;

	JSFX_FloatDiv('feedback', float_left,float_top).floatIt();

	return false;





}

/////////////////////////////////////////////////



////////////////////////////////////////////

function showForPassDiv(divId){		

	

	var obj = document.getElementById(divId);

	obj.style.display = 'block';

	

	

	var selObj = document.getElementsByTagName('select');

	for(i=0; i<selObj.length; i++){

		var selId = selObj[i].id;

		//document.getElementById(selId).disabled = true;

		document.getElementById(selId).style.visibility = 'hidden';

	}

	

	var cntObj 	  		= document.getElementById(CONTENTDIV);

	var cntHeight 		= cntObj.offsetHeight;

	var cntWidth		= cntObj.offsetWidth;

	

	if(SCREENHEIGHT == '994'){

		

		if(cntHeight < 1000 && cntHeight > 950){

			cntHeight = SCREENHEIGHT - 10;	

		}else if(cntHeight > 1000){

			cntHeight = cntHeight;

		}else{

			cntHeight = SCREENHEIGHT - 140;

		}

	}else if(SCREENHEIGHT == '738'){

		

		if(cntHeight > 700  && cntHeight < 750){			

			cntHeight = SCREENHEIGHT;

		}else if(cntHeight > 750 ){			

			cntHeight = cntHeight;

		}else if(cntHeight < SCREENHEIGHT){

			cntHeight = SCREENHEIGHT - 140;

		}else{			

			cntHeight = SCREENHEIGHT;

		}

	}

	

	

	document.getElementById("maskDivMedia").style.height = cntHeight+"px";

	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	

	document.getElementById("div_loading").style.display = 'block';

		

	var float_left = (SCREENWIDTH / 2) - 120;

	var float_top  = (SCREENHEIGHT / 3) - 120;

	JSFX_FloatDiv(divId, float_left,float_top).floatIt();

	return false;

}





function showHelpDiv(divId){

	

	var obj = document.getElementById(divId);

	obj.style.display = 'block';

		

	var selObj = document.getElementsByTagName('select');

	for(i=0; i<selObj.length; i++){

		var selId = selObj[i].id;

		//document.getElementById(selId).disabled = true;

		document.getElementById(selId).style.visibility = 'hidden';

	}

	

	

	var width 			= pageWidth();	

	var height 			= pageHeight();	

	var left 			= leftPosition(); 

	var top 			= topPosition();

	var dialogwidth 	= obj.offsetWidth;

	var dialogheight 	= obj.offsetHeight;

	var topposition 	= top + (height / 2) - (dialogheight / 2);

	var leftposition 	= left + (width / 2) - (dialogwidth / 2);

	obj.style.top 		= topposition + "px";

	obj.style.left 		= leftposition + "px";

	

	var cntObj 	  		= document.getElementById(CONTENTDIV);

	var cntHeight 		= cntObj.offsetHeight;

	var cntWidth		= cntObj.offsetWidth;

	

	if(SCREENHEIGHT == '994'){

		

		if(cntHeight < 1000 && cntHeight > 950){

			cntHeight = SCREENHEIGHT - 10;	

		}else if(cntHeight > 1000){

			cntHeight = cntHeight;

		}else{

			cntHeight = SCREENHEIGHT - 140;

		}

	}else if(SCREENHEIGHT == '738'){

		

		if(cntHeight > 700  && cntHeight < 750){			

			cntHeight = SCREENHEIGHT;

		}else if(cntHeight > 750 ){			

			cntHeight = cntHeight;

		}else if(cntHeight < SCREENHEIGHT){

			cntHeight = SCREENHEIGHT - 140;

		}else{			

			cntHeight = SCREENHEIGHT;

		}

	}

	

	document.getElementById("maskDivMedia").style.height = cntHeight+"px";

	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	

	document.getElementById("div_loading").style.display = 'block';

	

	var float_left = (SCREENWIDTH / 2) - 120;

	var float_top  = (SCREENHEIGHT / 3) - 120;

	JSFX_FloatDiv(divId, float_left,float_top).floatIt();

	return false;

}





function closeBox(){

	document.getElementById("showValId").style.display 	 = 'none';	

}



function closeBox2(){

	document.getElementById("showHelpId").style.display  = 'none';

	//document.getElementById("div_loading").style.display = 'none';

}



function closeMsgBox(divId){
 	//document.getElementById(divId).style.display = 'none';
	$("#"+divId).fadeOut(2000);
	$("#div_loading").fadeOut(2000);
	document.getElementById("div_loading").style.display = 'none';
}



function closeHomePop1(divId){
   	document.getElementById("foremail").value = '';
 	document.getElementById("checkpassword").value = '';
 	document.getElementById("foPassErr").innerHTML='';
 	//document.getElementById(divId).style.display = 'none';
	$j("#"+divId).fadeOut(2000);
	$j("#div_loading").fadeOut(2000);
	document.getElementById("div_loading").style.display = 'none';
}
function closeHomePop2(divId){
   	document.getElementById("reuseremail").value = '';
 	document.getElementById("checklink").value = '';
 	document.getElementById("reEmailErr").innerHTML='';
 	//document.getElementById(divId).style.display = 'none';
	$j("#"+divId).fadeOut(2000);
	$j("#div_loading").fadeOut(2000);
	document.getElementById("div_loading").style.display = 'none';

}


function closeHomePopregis(divId){
 	//document.getElementById("country").disabled = false;
 	document.getElementById("country").disabled = false;
 	//document.getElementById("question").disabled = false;
 	document.getElementById(divId).style.display = 'none';
 	document.getElementById("div_loading").style.display = 'none';
 
}

function closeFeedbackInner(divId){
 	var selObj = document.getElementsByTagName('select');	
 	for(i=0; i<selObj.length-1; i++){
 		var selId = selObj[i].id;		
 		document.getElementById(selId).style.visibility = 'visible';
 	}
 	document.getElementById(divId).style.display = 'none';
 	document.getElementById("div_loading").style.display = 'none';
 }

function closeFeedbackPop(divId){
 	//document.getElementById("country").disabled = false;
 	document.getElementById(divId).style.display = 'none';
 	document.getElementById("div_loading").style.display = 'none';

}

function closeOuterPopUp(divId){
 	var selObj = document.getElementsByTagName('select');	
 	for(i=0; i<selObj.length; i++){
 		var selId = selObj[i].id;		
 		document.getElementById(selId).style.visibility = 'visible';
 	}
  	document.getElementById(divId).style.display = 'none';
 	document.getElementById("div_loading").style.display = 'none';
 }





function hidePopUpDiv(divId){
 	document.getElementById(divId).style.display = 'none';
 }



function sendInvite(){
 	var se_usr_id 	= document.getElementById("seUsId").value;
 	var msg 		= document.getElementById("txtMes").value;
 	msg				= rm_trim(msg);
 	if(msg == ''){
 		messg = "You can't send invite unless you write anything";
 		document.getElementById("errMsgId").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>"+messg;
 		return false;
 	}else{
 		if(msg.length > 100){
 			messg = "Length of the message must be less than 100 characters";
 			document.getElementById("errMsgId").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>"+messg;
 			return false;
 		}else		
 			document.getElementById("errMsgId").innerHTML = '';		
 	}
 	var url = "send-invite.php?mess="+msg+"&seId="+se_usr_id;
 	//alert(url);return false;
 	document.getElementById("errMsgId").innerHTML = "<img src='images/loading.gif' alt='Invitation Sending....'>";
 	http_check.open("GET", url, true);				
 	http_check.onreadystatechange = function test(){					
 		if(http_check.readyState == 4) {
 			var response = http_check.responseText;
 			//alert(response);
 			if (response == 'yes'){
 				document.getElementById("txtMes").value = '';
 				document.getElementById("mainInvTbl").style.display = 'none';				
 				document.getElementById("msgInvTbl").style.display  = 'block';
 				//messg = 'Your invitation has been sent successfully.';
 				//document.getElementById("errMsgId").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>"+messg;
 			}else{
 				//messg = 'Some error has occured, Please try again after some time.';
 				document.getElementById("mainInvTbl").style.display = 'none';				
 				document.getElementById("msgInvTbl").style.display  = 'block';
 				var sendInviteDiv = "seInvDiv"+se_usr_id;
 				document.getElementById(sendInviteDiv).innerHTML = "<font color='#0099FF' face='Verdana' size='1'>invitation pending";
 				//messg = 'Your invitation has been sent successfully.';
 				//document.getElementById("errMsgId").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>"+messg;
 			}
 		}
 	}				
 	http_check.send(null);		
 }
 
function closeInviteBox(divId){
 	if(document.getElementById("mainInvTbl").style.display == 'none'){
 		document.getElementById("txtMes").value 	 = '';
 		document.getElementById("errMsgId").innerHTML= '';		
 		document.getElementById(divId).style.display = 'none';		
 	}else{
 		document.getElementById(divId).style.display = 'none';	
 	}
 }



function limitChar(tapMsgId, liDivId, totChars){	
 	var msg 	 = document.getElementById(tapMsgId).value;
 	var msgLen	 = msg.length;
  	if(msgLen > totChars){
 		document.getElementById(tapMsgId).value = msg.substring(0, totChars);
 	}else{
 		document.getElementById(liDivId).innerHTML = totChars - msgLen;
 	}	
 }



function deleteVideo(dId){
 	var obj 			= document.getElementById("vidDelDivId");
 	obj.style.display 	= 'block';
 	var width 			= pageWidth();
 	var height 			= pageHeight();
 	var left 			= leftPosition();
 	var top 			= topPosition();
 	var dialogwidth 	= obj.offsetWidth;
 	var dialogheight 	= obj.offsetHeight;
 	var topposition 	= top + (height / 2) - (dialogheight / 2);
 	var leftposition 	= left + (width / 2) - (dialogwidth / 2);
 	obj.style.top 		= topposition + "px";
 	obj.style.left 		= leftposition + "px";
  	var cntObj 	  		= document.getElementById(CONTENTDIV);
 	var cntHeight 		= cntObj.offsetHeight;
 	var cntWidth		= cntObj.offsetWidth;
  	if(cntHeight < SCREENHEIGHT){
 		cntHeight = SCREENHEIGHT - 190;
 	}
 	if(cntWidth < SCREENWIDTH){
 		cntWidth = SCREENWIDTH - 26;
 	}
 	document.getElementById("maskDivMedia").style.height = cntHeight+"px";
 	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";
 	document.getElementById("div_loading").style.display = 'block';	
 	document.getElementById("hDelId").value = dId;
 	var float_left = (SCREENWIDTH / 2) - 120;
 	var float_top  = (SCREENHEIGHT / 3) - 120;
 	JSFX_FloatDiv('vidDelDivId', float_left,float_top).floatIt();
 	return false;
 }



function closeDelBox(divId, type){
 	if(type == 'Y'){
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';	
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);
  		var delId = document.getElementById("hDelId").value;
 		window.location = 'video-view.php?vdi='+delId;
 	}else{
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);

	}	

}



function noMoreFavo(dId, showDiv){
 	var obj 			= document.getElementById(showDiv);	
 	obj.style.display 	= 'block';
  	var width 			= pageWidth();	
 	var height 			= pageHeight();	
 	var left 			= leftPosition(); 
 	var top 			= topPosition();
 	var dialogwidth 	= obj.offsetWidth;
 	var dialogheight 	= obj.offsetHeight;
 	var topposition 	= top + (height / 3) - (dialogheight / 2);
 	var leftposition 	= left + (width / 2) - (dialogwidth / 2);
 	obj.style.top 		= topposition + "px";
 	obj.style.left 		= leftposition + "px";
  	var cntObj 	  		= document.getElementById(CONTENTDIV);
 	var cntHeight 		= cntObj.offsetHeight;
 	var cntWidth 		= cntObj.offsetWidth;
 	if(cntHeight < SCREENHEIGHT){		
 		cntHeight = SCREENHEIGHT - 150;		
 	}
 	if(cntWidth < SCREENWIDTH){
 		cntWidth = SCREENWIDTH - 24;
 	}
 	document.getElementById("maskDivMedia").style.height = cntHeight+"px";
 	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";
 	document.getElementById("div_loading").style.display = 'block';
 	document.getElementById("hDelId").value = dId;
 	return false;
 }



function remFavorite(divId, type){
 	if(type == 'Y'){
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';	
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);
 		var delId = document.getElementById("hDelId").value;
 		window.location = 'my-favorites-video.php?favDelId='+delId;
 	}else{
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';		
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);
 	}	
 }



function remMediaFavorite(divId, type){
 	if(type == 'V'){
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';	
 		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);
 		var delId = document.getElementById("hDelId").value;
 		window.location = 'my-favorites-video.php?favDelId='+delId;
 	}else{
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';		
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);

	}	

}
 
function delPhotoAlbum(divId, type){
 	if(type == 'Y'){		
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);
 		var cPa	  = document.getElementById("curPa").value;		
 		var delId = document.getElementById("hDelId").value;
 		window.location = 'photo-album.php?did='+delId+'&page='+cPa;		
 	}else{
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';	
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);
 	}	

}

 
function delPhoto(divId, type){
 	if(type == 'Y'){
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';	
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);
  		var delId = document.getElementById("hDelId").value;
 		var albId = document.getElementById("hAlbId").value;
 		window.location = 'manage-photo.php?del_id='+delId+'&alb_id='+albId;

	}else{
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);
 	}	
 }
 
function remFavoritePopUp(dId,showDiv,relativeDivId){
   	var obj 		  	= document.getElementById(showDiv);
	var relObj		= document.getElementById(relativeDivId);
	document.getElementById("hDelId").value = dId;
	var divPos 		= GetLeftTopPosition(relObj);
	var posBody 	= divPos.split('::');
	var divLeft 	= parseInt(posBody[0]);
	var divTop 		= parseInt(posBody[1]);
	var openDivLeft = (divLeft-200);
	var openDivTop 	= (divTop);
	obj.style.top 	  = openDivTop+'px';
	obj.style.left 	  = openDivLeft+'px';
   	$("#"+showDiv).fadeIn(2000);
  	var det = getPageSize();
	cntWidth = det[0];
	cntHeight= det[1];
	document.getElementById("maskDivMedia").style.height = cntHeight+"px";
	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	
	//document.getElementById("div_loading").style.display = 'block';
	$("#div_loading").fadeIn(2000);
	return false;
}



function remFavorite(divId, type){
 	if(type == 'Y'){
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';	
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);
 		var delId = document.getElementById("hDelId").value;
 		window.location = 'my-favorites-photo.php?noMoId='+delId;
 	}else{
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';		
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);

	}	

}



function delCommentPopUp(dId, albId, showDiv){
 	var obj 		  	= document.getElementById(showDiv);
 	obj.style.display 	= 'block';
 	var width 			= pageWidth();	
 	var height 			= pageHeight();	
 	var left 			= leftPosition(); 
 	var top 			= topPosition();
 	var dialogwidth 	= obj.offsetWidth;
 	var dialogheight 	= obj.offsetHeight;
 	var topposition 	= top + (height / 2) - (dialogheight / 2);
 	var leftposition 	= left + (width / 2) - (dialogwidth / 2);
 	obj.style.top 		= topposition + "px";
 	obj.style.left 		= leftposition + "px";
 	var cntObj 	  		= document.getElementById(CONTENTDIV);
 	var cntHeight 		= cntObj.offsetHeight;
 	var cntWidth		= cntObj.offsetWidth;
  	if(cntHeight < SCREENHEIGHT){
 		cntHeight = SCREENHEIGHT - 190;
 	}
 	if(cntWidth < SCREENWIDTH){
 		cntWidth = SCREENWIDTH - 26;
 	}
 	document.getElementById("maskDivMedia").style.height = cntHeight+"px";
 	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	
 	document.getElementById("div_loading").style.display = 'block';	
 	document.getElementById("hDelId").value = dId;
 	document.getElementById("hAlbId").value = albId;	
 	var float_left = (SCREENWIDTH / 2) - 120;
 	var float_top = (SCREENHEIGHT / 3) - 120;
 	JSFX_FloatDiv(showDiv, float_left,float_top).floatIt();
 	return false;	
 }



function delComment(divId, type){
 	if(type == 'Y'){
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';	
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);
 		var delId  = document.getElementById("hDelId").value;
 		var albId  = document.getElementById("hAlbId").value		
 		var imgId = document.getElementById("proImgId").value;
 		window.location = 'photo-view.php?delCommId='+delId+'&alb_id='+albId+'&proImgId='+imgId;
 	}else{
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';		
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);

	}	

}



function delFansterCommentPopUp(dId, showDiv){
 	var obj 		  	= document.getElementById(showDiv);
 	obj.style.display 	= 'block';
 	var width 			= pageWidth();	
 	var height 			= pageHeight();	
 	var left 			= leftPosition(); 
 	var top 			= topPosition();
 	var dialogwidth 	= obj.offsetWidth;
 	var dialogheight 	= obj.offsetHeight;
 	var topposition 	= top + (height / 2) - (dialogheight / 2);
 	var leftposition 	= left + (width / 2) - (dialogwidth / 2);
 	obj.style.top 		= topposition + "px";
 	obj.style.left 		= leftposition + "px";
 	var cntObj 	  		= document.getElementById(CONTENTDIV);
 	var cntHeight 		= cntObj.offsetHeight;
 	var cntWidth		= cntObj.offsetWidth;
  	if(cntHeight < SCREENHEIGHT){
 		cntHeight = SCREENHEIGHT - 190;
 		//alert(cntHeight);
 	}
 	if(cntWidth < SCREENWIDTH){
 		cntWidth = SCREENWIDTH - 26;
 	}
 	document.getElementById("maskDivMedia").style.height = cntHeight+"px";
 	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	
 	document.getElementById("div_loading").style.display = 'block';	
  	document.getElementById("hDelId").value = dId;
 	var float_left = (SCREENWIDTH / 2) - 120;
 	var float_top = (SCREENHEIGHT / 3) - 120;
 	JSFX_FloatDiv(showDiv, float_left,float_top).floatIt();	
 	return false;	
 }



function delFansterComment(divId, type){
 	if(type == 'Y'){
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';	
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);
 		var delId  	= document.getElementById("hDelId").value;	
 		var imgId 	= document.getElementById("proImgId").value;
 		var comUsId = document.getElementById("hUsId").value;
  		window.location = 'fanster-photo-list.php?delCommId='+delId+'&proImgId='+imgId+'&usId='+comUsId;
 	}else{
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';		
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);
 	}	
 }



function delAudFansCommPopUp(dId, usId, auId, showDiv){
 	var obj 		  	= document.getElementById(showDiv);
 	obj.style.display 	= 'block';
  	var width 			= pageWidth();	
 	var height 			= pageHeight();	
 	var left 			= leftPosition(); 
 	var top 			= topPosition();
 	var dialogwidth 	= obj.offsetWidth;
 	var dialogheight 	= obj.offsetHeight;
 	var topposition 	= top + (height / 2) - (dialogheight / 2);
 	var leftposition 	= left + (width / 2) - (dialogwidth / 2);
 	obj.style.top 		= topposition + "px";
 	obj.style.left 		= leftposition + "px";
 	var cntObj 	  		= document.getElementById(CONTENTDIV);
 	var cntHeight 		= cntObj.offsetHeight;
 	var cntWidth		= cntObj.offsetWidth;
 	if(cntHeight < SCREENHEIGHT){
 		cntHeight = SCREENHEIGHT - 190;
 		//alert(cntHeight);
 	}
 	if(cntWidth < SCREENWIDTH){
 		cntWidth = SCREENWIDTH - 26;
 	}
 	document.getElementById("maskDivMedia").style.height = cntHeight+"px";
 	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	
 	document.getElementById("div_loading").style.display = 'block';	
  	document.getElementById("hDelId").value = dId;
 	document.getElementById("hUsId").value  = usId;
 	document.getElementById("hAuId").value  = auId;
 	var float_left = (SCREENWIDTH / 2) - 120;
 	var float_top = (SCREENHEIGHT / 3) - 120;
 	JSFX_FloatDiv(showDiv, float_left,float_top).floatIt();
 	return false;	

}



function delAudioFansterComment(divId, type){
 	if(type == 'Y'){
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';	
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);
 		var delId  	= document.getElementById("hDelId").value;	
 		var ausId 	= document.getElementById("hAuId").value;
 		var comUsId = document.getElementById("hUsId").value;
 		window.location = 'fanster-audio-list.php?delCommId='+delId+'&auSongId='+ausId+'&usId='+comUsId;
 	}else{
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';		
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);

	}	

}







function delAudioAlbum(divId, type){
 	if(type == 'Y'){
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';	
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);
 		var delId = document.getElementById("hDelId").value;
 		window.location = 'audio-album.php?did='+delId;
 	}else{
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';		
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);
 	}	

}



function audioFavoPopUp(dId, showDiv){
 	var obj 		= document.getElementById(showDiv);	
 	obj.style.display = 'block';
 	var obj 			= document.getElementById(showDiv);	
 	var width 			= pageWidth();	
 	var height 			= pageHeight();	
 	var left 			= leftPosition(); 
 	var top 			= topPosition();
 	var dialogwidth 	= obj.offsetWidth;
 	var dialogheight 	= obj.offsetHeight;
 	var topposition 	= top + (height / 2) - (dialogheight / 2);
 	var leftposition 	= left + (width / 2) - (dialogwidth / 2);
 	obj.style.top 		= topposition + "px";
 	obj.style.left 		= leftposition + "px";
 	var cntObj 	  		= document.getElementById(CONTENTDIV);
 	var cntHeight 		= cntObj.offsetHeight;
 	var cntWidth		= cntObj.offsetWidth;
  	if(cntWidth < SCREENWIDTH){
 		cntWidth = SCREENWIDTH - 26;
 	}
 	document.getElementById("maskDivMedia").style.height = cntHeight+"px";
 	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";
 	document.getElementById("div_loading").style.display = 'block';	
 	document.getElementById("hDelId").value = dId;
 	var float_left = (SCREENWIDTH / 2) - 120;
 	var float_top = (SCREENHEIGHT / 3) - 120;
 	JSFX_FloatDiv(showDiv, float_left,float_top).floatIt();
 	return false;	

}



function remAudioFavorite(divId, type){
 	if(type == 'Y'){
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';	
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);
 		var delId = document.getElementById("hDelId").value;
 		window.location = 'my-favorites-audio.php?favDelId='+delId;
 	}else{
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';		
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);
 	}	
 }

 
function setBrVal(val)

{

	document.getElementById('TPL_ALB_BR_VAL').value = val;

}
 //+++This function is for show video flag div



//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 // This function is for send the flag video

function sendFlag(divId){
 	var msg = document.getElementById("flagId").value;
 	var mType = document.getElementById("mType").value;
 	var mTypeId = document.getElementById("mTypeId").value;
 	var val = document.getElementById("capId").innerHTML;
 	var url = "send-flag.php?ms="+msg+"&ca="+val+"&mtype="+mType+"&mtypeid="+mTypeId;
 	//alert(url);//return false;
 	http_check.open("GET", url, true);
 	http_check.onreadystatechange = function test(){
 		if(http_check.readyState == 4) {
 			var response = http_check.responseText;
 			//alert(response);//return false;
 			if(response == 1){
				$("#"+divId).fadeOut(2000);
				$("#div_loading").fadeOut(2000);

			}else{
				document.getElementById('flagErrId').innerHTML = 'Try again...';

			}

		}

	}

	http_check.send(null);

}



function closePopUp(divId){

  $("#"+divId).fadeOut(2000);
$("#div_loading").fadeOut(2000);
}

function delAudioCommentPopUp12(dId, audId, showDiv){
 	var obj 		  	= document.getElementById(showDiv);
 	obj.style.display 	= 'block';
 	var daid			=document.getElementById(audId).value;//this is added by dinesh
 	var width 			= pageWidth();	
 	var height 			= pageHeight();	
 	var left 			= leftPosition(); 
 	var top 			= topPosition();
 	var dialogwidth 	= obj.offsetWidth;
 	var dialogheight 	= obj.offsetHeight;
 	var topposition 	= top + (height / 2) - (dialogheight / 2);
 	var leftposition 	= left + (width / 2) - (dialogwidth / 2);
 	obj.style.top 		= topposition + "px";
 	obj.style.left 		= leftposition + "px";
 	var cntObj 	  		= document.getElementById(CONTENTDIV);
 	var cntHeight 		= cntObj.offsetHeight;
 	var cntWidth		= cntObj.offsetWidth;
 	if(cntHeight < SCREENHEIGHT){
 		cntHeight = SCREENHEIGHT - 190;
 		//alert(cntHeight);
 	}
 	if(cntWidth < SCREENWIDTH){
 		cntWidth = SCREENWIDTH - 26;
 	}
 	document.getElementById("maskDivMedia").style.height = cntHeight+"px";
 	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	
 	document.getElementById("div_loading").style.display = 'block';	
 	document.getElementById("hDelId").value = dId;
 	document.getElementById("hAlbId").value = daid;	
 	var float_left = (SCREENWIDTH / 2) - 194;
 	var float_top = (SCREENHEIGHT / 3) - 120;
 	JSFX_FloatDiv(showDiv, float_left,float_top).floatIt();
 	return false;

}



function delAudioComment(divId, type){
 	if(type == 'Y'){
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';	
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);
 		var delId  = document.getElementById("hDelId").value;
 		var albId  = document.getElementById("hAlbId").value;		
 		window.location = 'audio-view.php?delCommId='+delId+'&albId='+albId;
 	}else{
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';		
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);

	}	

}







//renaming by dinesh/////////////////////////

function delVideoComment_21aug_old(divId, type){
 	if(type == 'Y'){
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';	
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);
 		var delId  = document.getElementById("hComId").value;
 		var v_id  = document.getElementById("hVidId").value;		
 		//alert(delId +"||"+v_id);return false;
 		window.location = 'video-view.php?delCommId='+delId+'&vId='+v_id;
 	}else{
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';		
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);

	}	

}



function delAudioSongPopUp(dId, albId, showDiv){
 	var obj 		  	= document.getElementById(showDiv);
 	obj.style.display 	= 'block';
  	var width 			= pageWidth();	
 	var height 			= pageHeight();	
 	var left 			= leftPosition(); 
 	var top 			= topPosition();
 	var dialogwidth 	= obj.offsetWidth;
 	var dialogheight 	= obj.offsetHeight;
 	var topposition 	= top + (height / 2) - (dialogheight / 2);
 	var leftposition 	= left + (width / 2) - (dialogwidth / 2);
 	obj.style.top 		= topposition + "px";
 	obj.style.left 		= leftposition + "px";
 	var cntObj 	  		= document.getElementById(CONTENTDIV);
 	var cntHeight 		= cntObj.offsetHeight;
 	var cntWidth		= cntObj.offsetWidth;
 	if(cntHeight < SCREENHEIGHT){
 		//cntHeight = SCREENHEIGHT - 190;
 		//alert(cntHeight);
 	}
 	if(cntWidth < SCREENWIDTH){
 		cntWidth = SCREENWIDTH - 26;
 	}
 	document.getElementById("maskDivMedia").style.height = cntHeight+"px";
 	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	
 	document.getElementById("div_loading").style.display = 'block';	
 	document.getElementById("hAudDelId").value = dId;
 	document.getElementById("hAudAlbId").value = albId;	
 	var float_left = (SCREENWIDTH / 2) - 120;
 	var float_top = (SCREENHEIGHT / 3) - 120;
 	JSFX_FloatDiv(showDiv, float_left,float_top).floatIt();
 	return false;	
 }
 
function delAudioSong(divId, type){
 	if(type == 'Y'){
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';	
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);
 		var delId  = document.getElementById("hAudDelId").value;
 		var albId  = document.getElementById("hAudAlbId").value;		
 		window.location = 'audio-view.php?aui='+delId+'&alb_id='+albId;
 	}else{
 		//document.getElementById(divId).style.display = 'none';
 		//document.getElementById("div_loading").style.display = 'none';		
		$("#"+divId).fadeOut(2000);
		$("#div_loading").fadeOut(2000);

	}	

}



function openCompDiv(showDiv){
 	var obj 		  	= document.getElementById(showDiv);
 	obj.style.display 	= 'block';
 	var totComp			= document.getElementById("hTotComp").value;
 	//alert(totComp);
 	var totCompRow		= totComp/2;
 	var totCompRem		= totComp%2;
 	var height			= 0;
 	if(totCompRem == 1){
 		height += 10;
 	}
 	var popUpDivHei		= totCompRow * 20 + 130 + height;
 	obj.style.height	= popUpDivHei;
 	var width 			= pageWidth();	
 	var height 			= pageHeight();	
 	var left 			= leftPosition(); 
 	var top 			= topPosition();
 	var dialogwidth 	= obj.offsetWidth;
 	var dialogheight 	= obj.offsetHeight;
 	var topposition 	= top + (height / 2) - (dialogheight / 2);
 	var leftposition 	= left + (width / 2) - (dialogwidth / 2);
 	obj.style.top 		= topposition + "px";
 	obj.style.left 		= leftposition + "px";
 	var cntObj 	  		= document.getElementById(CONTENTDIV);
 	var cntHeight 		= cntObj.offsetHeight;
 	var cntWidth		= cntObj.offsetWidth;
 	if(cntHeight < SCREENHEIGHT){
 		cntHeight = SCREENHEIGHT - 190;
 		//alert(cntHeight);
 	}
 	if(cntWidth < SCREENWIDTH){
 		cntWidth = SCREENWIDTH - 26;
 	}
 	document.getElementById("maskDivMedia").style.height = cntHeight+"px";
 	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	
 	document.getElementById("div_loading").style.display = 'block';
 	return false;	
 }



/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////Function for check user login at download audio from slash user page start here/////////////////////



function checkUserLogin(){ 
  document.headerloginfrm.uname.focus();
 document.getElementById("loginalert").innerHTML="<font color='red' face='Verdana' size='2'>&nbsp;&nbsp;Login Required.</font>";
}

////////////////Function for check user login at download audio from slash user page ends here/////////////////////



function getDwnLoadAudCost(audId){
 	var url = "../user/getAudioCost.php?audId="+audId;
 						http_check.open("GET", url, true);				
 						http_check.onreadystatechange = function test(){	
 							if(http_check.readyState == 4) {							
 								var response = http_check.responseText; 
 								//alert(response);return false;
 								var ext = response.split('~~');
 								//alert(ext);
 								if (ext[0] == 'yes'){
 									var	price	=	ext[1]+' '+ext[2];
 												//<a href="javascript:void(0);" onclick="checkUsrAccountBal('dwnLoadFailMsg','dwnLoadAud','{$id}');">Pay to proceed.....</a>
 									var getMsg	=	"To download it will cost you"+' '+price;
 									var resmessage="<font size='2' color='#000000' font-family='Verdana'>"+getMsg+"</font>";
 									//alert(resmessage);
 									document.getElementById('downLoadMsg').innerHTML = resmessage;
 									//return true;
 									}else{
 										var getMsg	=	"To download it will cost you free";
 										var resmessage="<font size='2' color='#000000' font-family='Verdana'>"+getMsg+"</font>";
 										//alert(resmessage);
 										document.getElementById('downLoadMsg').innerHTML = resmessage;
 
									}
 							}

						}	
 						http_check.send(null);
  
}



////////////////Function for proceed to download audio from slash user page start here/////////////////////



function GetLeftTopPosition(obj)
 {
     var topValue= 0,leftValue= 0;
     while(obj){
 		leftValue+= obj.offsetLeft;
 		topValue+= obj.offsetTop;
 		obj= obj.offsetParent;
     }
 	finalvalue = leftValue+"::"+topValue;
     return finalvalue;
 }
 function proceedToDwnAud(showDiv,relativeDivId){
	//alert(phid);
	var dwnAudId	=	document.getElementById("hiAudId").value;
 	var obj 		  	= document.getElementById(showDiv);
	var relObj		= document.getElementById(relativeDivId);
	var divPos 		= GetLeftTopPosition(relObj);
	var posBody 	= divPos.split('::');
	var divLeft 	= parseInt(posBody[0]);
	var divTop 		= parseInt(posBody[1]);
	var openDivLeft = (divLeft+200);
	var openDivTop 	= (divTop-20);
	obj.style.top 	  = openDivTop+'px';
	obj.style.left 	  = openDivLeft+'px';
	$("#dwnLoadAud").fadeIn(1000);
 	var det = getPageSize();
	cntWidth = det[0];
	cntHeight= det[1];
	document.getElementById("maskDivMedia").style.height = cntHeight+"px";
	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	
	//document.getElementById("div_loading").style.display = 'block';
	$("#div_loading").fadeIn(1000);
	return false;
}

////////////////Function for  proceed to download audio from slash user page ends here/////////////////////
 ////////////////Function for proceed to download audio from slash user page start here/////////////////////



function checkUsrAccountBal(showDiv,hideDivId,usrId,relativeDivId){
 	var obj 		  	= document.getElementById(showDiv);
 	var url = "../user/checkUserAccount.php?uid="+usrId;
 						http_check.open("GET", url, true);				
 						http_check.onreadystatechange = function test(){	
 							if(http_check.readyState == 4) {							
 								var response = http_check.responseText; 
								//alert(response);
 								if (response == 0){
 										//obj.style.display 	= 'block';
										$("#dwnLoadAud").fadeOut(1000);
  										//document.getElementById(hideDivId).style.display 	= 'none';
 										var relObj		= document.getElementById(relativeDivId);
										var divPos 		= GetLeftTopPosition(relObj);
										var posBody 	= divPos.split('::');
										var divLeft 	= parseInt(posBody[0]);
										var divTop 		= parseInt(posBody[1]);
										var openDivLeft = (divLeft+240);
										var openDivTop 	= (divTop-20);
										obj.style.top 	  = openDivTop+'px';
										obj.style.left 	  = openDivLeft+'px';
										$("#dwnLoadFailMsg").fadeIn(1000);
										//document.getElementById("commDelId").value = relativeDivId;
										var det = getPageSize();
										cntWidth = det[0];
										cntHeight= det[1];
										document.getElementById("maskDivMedia").style.height = cntHeight+"px";
										document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	
										//document.getElementById("div_loading").style.display = 'block';
										$("#div_loading").fadeIn(1000);
										return false;
 									}else{
 										var audname	= document.getElementById("hiAudName").value;
 										obj.style.display 	= 'none';
 										document.getElementById(hideDivId).style.display 	= 'none';
 										//document.getElementById("div_loading").style.display = 'none';
										$("#dwnLoadAud").fadeOut(2000);
										$("#div_loading").fadeOut(2000);
  										window.location="../user/download.php?f="+audname;
  									}
 							}

						}	
 						http_check.send(null);
 
 }

////////////////Function for  proceed to download audio from slash user page ends here/////////////////////
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



/*===============================================================*/

//=== 		This code for float the div		======================



var ns = (navigator.appName.indexOf("Netscape") != -1);

var d = document;

function JSFX_FloatDiv(id, sx, sy)

{

	var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];

	var px = document.layers ? "" : "px";

	window[id + "_obj"] = el;

	if(d.layers)el.style=el;

	el.cx = el.sx = sx;el.cy = el.sy = sy;

	el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};



	el.floatIt=function()

	{

		var pX, pY;

		pX = (this.sx >= 0) ? 0 : ns ? innerWidth : parent.document.documentElement && parent.document.documentElement.clientWidth ? parent.document.documentElement.clientWidth : parent.document.body.clientWidth;

		pY = ns ? pageYOffset : parent.document.documentElement && parent.document.documentElement.scrollTop ? parent.document.documentElement.scrollTop : parent.document.body.scrollTop;

		if(this.sy<0) 

		pY += ns ? innerHeight : parent.document.documentElement && parent.document.documentElement.clientHeight ? parent.document.documentElement.clientHeight : parent.document.body.clientHeight;

		this.cx += (pX + this.sx - this.cx)/8;this.cy += (pY + this.sy - this.cy)/8;

		this.sP(this.cx, this.cy);

		setTimeout(this.id + "_obj.floatIt()", 40);

	}

	return el;

}

/*===============================================================*/





function apply_masking(){
 	var obj = document.getElementById("chkLogMsgId");
 	obj.style.display = 'block';
 	//document.getElementById("country").disabled = true;
 	var width 			= pageWidth();	
 	var height 			= pageHeight();	
 	var left 			= leftPosition(); 
 	var top 			= topPosition();
 	var dialogwidth 	= obj.offsetWidth;
 	var dialogheight 	= obj.offsetHeight;
 	var topposition 	= top + (height / 2) - (dialogheight / 2);
 	var leftposition 	= left + (width / 2) - (dialogwidth / 2);
 	obj.style.top 		= "150px";
 	obj.style.left 		= "260px";
 	var cntObj 	  		= document.getElementById(CONTENTDIV);
 	var cntHeight 		= cntObj.offsetHeight;
 	var cntWidth		= cntObj.offsetWidth;
 	if(SCREENHEIGHT == '994'){
 		cntHeight = SCREENHEIGHT - 170;
 	}else if(SCREENHEIGHT == '738'){
 		cntHeight = SCREENHEIGHT - 70;
 	}
 	document.getElementById("maskDivMedia").style.height = cntHeight+"px";
 	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	
 	document.getElementById("div_loading").style.display = 'block';
 }





function show_popup(showDiv){
 	var obj 		  	= document.getElementById(showDiv);
 	obj.style.display 	= 'block';
 	var width 			= pageWidth();	
 	var height 			= pageHeight();	
 	var left 			= leftPosition(); 
 	var top 			= topPosition();
 	var dialogwidth 	= obj.offsetWidth;
 	var dialogheight 	= obj.offsetHeight;
 	var topposition 	= top + (height / 2) - (dialogheight / 2);
 	var leftposition 	= left + (width / 2) - (dialogwidth / 2);
 	obj.style.top 		= topposition + "px";
 	obj.style.left 		= leftposition + "px";	
 }



function hide_popup(showDiv){	
 	document.getElementById(showDiv).style.display 	= 'none';
 	document.getElementById("div_loading").style.display = 'none';
 }

////////////////////////////added by dinesh 20 aug 08////////////////////////////////
 ///////////////////////////////////added by dinesh ends here/////////////////////////////////////



/**

* Show text on home page image

*/

/***********************************************

* Image w/ description tooltip- By Dynamic Web Coding (www.dyn-web.com)

* Copyright 2002-2007 by Sharon Paine

* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code

***********************************************/



/* IMPORTANT: Put script after tooltip div or 

	 put tooltip div just before </BODY>. */



var dom = (document.getElementById) ? true : false;

var ns5 = (!document.all && dom || window.opera) ? true: false;

var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;

var ie4 = (document.all && !dom) ? true : false;

var nodyn = (!ns5 && !ie4 && !ie5 && !dom) ? true : false;



var origWidth, origHeight;



// avoid error of passing event object in older browsers

if (nodyn) { event = "nope" }



///////////////////////  CUSTOMIZE HERE   ////////////////////

// settings for tooltip 

// Do you want tip to move when mouse moves over link?

var tipFollowMouse= true;	

// Be sure to set tipWidth wide enough for widest image

var tipWidth= 200;

var offX= 30;	// how far from mouse to show tip

var offY= 10; 

var tipFontFamily= "Verdana, Verdana, helvetica, sans-serif";

var tipFontSize= "9pt";

// set default text color and background color for tooltip here

// individual tooltips can have their own (set in messages arrays)

// but don't have to

var tipFontColor	= "#3D3D3D";

var tipBgColor		= "#FFFFFF"; 

var tipBorderColor	= "#00CCCC";

var tipBorderWidth	= 3;

var tipBorderStyle	= "ridge";

var tipPadding		= 2;



// tooltip content goes here (image, description, optional bgColor, optional textcolor)

var messages = new Array();

// multi-dimensional arrays containing: 

// image and text for tooltip

// optional: bgColor and color to be sent to tooltip

messages[0] = new Array('', '<b>Join now to get discovered</b>', "");



////////////////////  END OF CUSTOMIZATION AREA  ///////////////////



// preload images that are to appear in tooltip

// from arrays above

/*if (document.images) {

	var theImgs = new Array();

	for (var i=0; i<messages.length; i++) {

  	theImgs[i] = new Image();

		theImgs[i].src = messages[i][0];

  }

}*/



// to layout image and text, 2-row table, image centered in top cell

// these go in var tip in doTooltip function

// startStr goes before image, midStr goes between image and text

var startStr = '<table width="' + tipWidth + '" align="center"><tr><td valign="middle">';

var midStr   = '</td></tr></table>';

var endStr   = '';



////////////////////////////////////////////////////////////

//  initTip	- initialization for tooltip.

//		Global variables for tooltip. 

//		Set styles

//		Set up mousemove capture if tipFollowMouse set true.

////////////////////////////////////////////////////////////

var tooltip, tipcss;

function initTip() {

	if (nodyn) return;

	tooltip = (ie4)? document.all['tipDiv']: (ie5||ns5)? document.getElementById('tipDiv'): null;

	tipcss = tooltip.style;

	if (ie4||ie5||ns5) {	// ns4 would lose all this on rewrites

		tipcss.width = tipWidth+"px";

		tipcss.fontFamily = tipFontFamily;

		tipcss.fontSize = tipFontSize;

		tipcss.color = tipFontColor;

		tipcss.backgroundColor = tipBgColor;

		tipcss.borderColor = tipBorderColor;

		tipcss.borderWidth = tipBorderWidth+"px";

		tipcss.padding = tipPadding+"px";

		tipcss.borderStyle = tipBorderStyle;

	}

	if (tooltip&&tipFollowMouse) {

		document.onmousemove = trackMouse;

	}

}



window.onload = initTip;



/////////////////////////////////////////////////

//  doTooltip function

//			Assembles content for tooltip and writes 

//			it to tipDiv

/////////////////////////////////////////////////

var t1,t2;	// for setTimeouts

var tipOn = false;	// check if over tooltip link

function doTooltip(evt,num) {

	if (!tooltip) return;

	if (t1) clearTimeout(t1);	if (t2) clearTimeout(t2);

	tipOn = true;

	// set colors if included in messages array

	if (messages[num][2])	var curBgColor = messages[num][2];

	else curBgColor = tipBgColor;

	if (messages[num][3])	var curFontColor = messages[num][3];

	else curFontColor = tipFontColor;

	if (ie4||ie5||ns5) {

		var tip = startStr + messages[num][0] + midStr + '<span style="font-family:' + tipFontFamily + '; font-size:' + tipFontSize + '; color:' + curFontColor + ';">' + messages[num][1] + '</span>';

		tipcss.backgroundColor = curBgColor;

	 	tooltip.innerHTML = tip;

	}

	if (!tipFollowMouse) positionTip(evt);

	else t1=setTimeout("tipcss.visibility='visible'",100);

}



var mouseX, mouseY;

function trackMouse(evt) {

	standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes

	mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;

	mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;

	if (tipOn) positionTip(evt);

}



/////////////////////////////////////////////////////////////

//  	positionTip function

//		If tipFollowMouse set false, so trackMouse function

//		not being used, get position of mouseover event.

//		Calculations use mouseover event position, 

//		offset amounts and tooltip width to position

//		tooltip within window.

/////////////////////////////////////////////////////////////

function positionTip(evt) {

	if (!tipFollowMouse) {

		standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body

		mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;

		mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;

	}

	// tooltip width and height

	var tpWd = (ie4||ie5)? tooltip.clientWidth: tooltip.offsetWidth;

	var tpHt = (ie4||ie5)? tooltip.clientHeight: tooltip.offsetHeight;

	// document area in view (subtract scrollbar width for ns)

	var winWd = (ns5)? window.innerWidth-20+window.pageXOffset: standardbody.clientWidth+standardbody.scrollLeft;

	var winHt = (ns5)? window.innerHeight-20+window.pageYOffset: standardbody.clientHeight+standardbody.scrollTop;

	// check mouse position against tip and window dimensions

	// and position the tooltip 

	if ((mouseX+offX+tpWd)>winWd) 

		tipcss.left = mouseX-(tpWd+offX)+"px";

	else tipcss.left = mouseX+offX+"px";

	if ((mouseY+offY+tpHt)>winHt) 

		tipcss.top = winHt-(tpHt+offY)+"px";

	else tipcss.top = mouseY+offY+"px";

	if (!tipFollowMouse) t1=setTimeout("tipcss.visibility='visible'",100);

}



function hideTip() {

	if (!tooltip) return;

	t2=setTimeout("tipcss.visibility='hidden'",100);

	tipOn = false;

}





document.write('<div id="tipDiv" style="position:absolute; visibility:hidden; z-index:100"></div>');



/*end here*/

////////////////////////////////////////////////////////////////Photo upload home 27 AUG////

function showUploadphotoDIV(){	

	

	//alert(document.getElementById("uploadphoto").value);

	

	var obj = document.getElementById("showUploadphoto");

	obj.style.display = 'block';

	//document.getElementById("uploadphoto").disabled = false;

	document.getElementById("upFi").innerHTML = '<input type="file" name="uploadphoto" id="uploadphoto" class="" onchange="return imageUpload_home(this);"/>'

	//document.getElementById("uploadphoto").value	= '';

	document.getElementById("dologin").style.display='none';

	document.getElementById("loginDIV").style.display='none';

	document.getElementById("regsDIV").style.display='none';

	document.getElementById("errMsgDiv").style.display='none';

	

	//document.getElementById("reEmailErr").innerHTML = '';

	

	var width 			= pageWidth();	

	var height 			= pageHeight();	

	var left 			= leftPosition(); 

	var top 			= topPosition();

	var dialogwidth 	= obj.offsetWidth;

	var dialogheight 	= obj.offsetHeight;

	var topposition 	= top + (height / 2) - (dialogheight / 2);

	var leftposition 	= left + (width / 2) - (dialogwidth / 2);

	obj.style.top 		= topposition + "px";

	obj.style.left 		= leftposition + "px";

	

	var cntObj 	  		= document.getElementById(CONTENTDIV);

	var cntHeight 		= cntObj.offsetHeight;

	var cntWidth		= cntObj.offsetWidth;

		

	if(SCREENHEIGHT == '994'){

		

		if(cntHeight < 1000 && cntHeight > 950){

			cntHeight = SCREENHEIGHT - 10;	

		}else if(cntHeight > 1000){

			cntHeight = cntHeight;

		}else{

			cntHeight = SCREENHEIGHT - 140;

		}

	}else if(SCREENHEIGHT == '738'){

		

		if(cntHeight > 700  && cntHeight < 750){			

			cntHeight = SCREENHEIGHT;

		}else if(cntHeight > 750 ){			

			cntHeight = cntHeight;

		}else if(cntHeight < SCREENHEIGHT){

			cntHeight = SCREENHEIGHT - 140;

		}else{			

			cntHeight = SCREENHEIGHT;

		}

	}

	

	document.getElementById("maskDivMedia").style.height = cntHeight+"px";

	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";

	

	document.getElementById("div_loading").style.display = 'block';

	

}

////////////////////////////////////////////



function imageUpload_home(obj){

	//alert("pawan");

	if(document.getElementById("caption").value==''){

		

	document.getElementById("errdiv").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>All fields are required";

	document.getElementById("uploadphoto").value=='';

	document.getElementById("caption").focus();

		return false;

		}

	else{

		document.getElementById("errdiv").innerHTML ='';

		

		}



	document.getElementById("errMsgDiv").style.display='block';

	var fileVal = obj.value;

	var ext 	= fileVal.substring(fileVal.lastIndexOf(".")+1,fileVal.length).toLowerCase();

		

	if(ext != 'jpg' && ext != 'jpeg' && ext != 'gif' && ext != 'png'){

		document.getElementById("errMsgDiv").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>Format not supported";

		return false;		

	}else{

		document.getElementById("errMsgDiv").innerHTML = "";

		

		$('#viProgId')

			.ajaxStart(function(){

				//document.getElementById('viUplButton').disabled = true;

				$(this).show();

			})

			.ajaxComplete(function(){

				//document.getElementById('viUplButton').disabled = false;

				$(this).hide();

			});	

		

		$.ajaxFileUpload

			(

				{

					url:'home_photo_upload.php',

					secureuri:false,

					fileElementId:'uploadphoto',

					dataType: 'json',

					success: function (data, status)

					{

						if(typeof(data.error) != 'undefined')

						{

							if(data.error != ''){							

								//alert("data error :"+data.error);

								document.getElementById("errMsgDiv").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>try again.";

							}else{

								//alert('Your image has been uploaded successfully.');

								

								var retMsg = data.msg;

								var responseTxt = retMsg.split('~~');

								//alert(responseTxt[0]);

								if(responseTxt[0] == 'success'){

									

									//document.getElementById("hNewImgName").value 	= responseTxt[1];

									document.getElementById("errMsgDiv").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>Your image has been uploaded, now proceed further.";

									document.getElementById('uploadphoto').disabled		= true;																										

									//document.getElementById('doneButId').disabled 		= false;

									document.getElementById('dologin').style.display 	= 'block';

									

								}else if(responseTxt[0] == 'size' && responseTxt[1] == 'problem'){

									

									//alert('size problem');

									//document.getElementById('doneButId').disabled 	= false;

									document.getElementById("errMsgDiv").innerHTML 	= "<font color='#FFA537' face='Verdana' size='1'>Image size not greater than 10Mb";

									

								}

							}

						}

					},

					error: function (data, status, e)

					{

						//alert("error: "+e);

						document.getElementById("errMsgDiv").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>Incorrect path.";

					}

				}

			)		

			return false;

	}

}



/////////////////////////////////////////////////////////

function logincheckUpload(){

	//alert("pawan");

	var caption  = document.getElementById("caption").value;	

	var errCnt 	= 0;

	var u_name  = document.getElementById("usr_name").value;

	//alert(u_name);

	u_name		= rm_trim(u_name);	

	if(u_name == ''){		

		errCnt++;

	}

	var u_pwd 	= document.getElementById("usr_pwd").value;

	u_pwd		= rm_trim(u_pwd);

	if(u_pwd == ''){

		errCnt++;

	}

	//alert(errCnt);return false;

	

	if(errCnt > 0){

		var message = "All fields are required";

		document.getElementById('errmsghomeid').innerHTML = message;

		return false;

	}else{

		//alert("loog");

		

		document.getElementById('errmsghomeid').innerHTML = "";

		var url = "check-login-comp.php?usrname="+u_name+"&usrpass="+u_pwd+"&caption="+caption;



		//alert(url);//return false;

		http_check.open("GET", url, true);

		http_check.onreadystatechange = function test(){

			//alert(http_check.readyState);

			if(http_check.readyState == 4) {

				var response = http_check.responseText;

				//alert(response);

				if (response == "no"){

					var message = "Incorrect entry. Re-enter!";

					document.getElementById('errmsghomeid').innerHTML = message;

					return false;

				}

				else{

					//alert("pawan");

					//window.location="photo-view.php?alb_id="+response;

					window.location="campaign.php";

					window.event.returnValue=false;					

				}			

			}

		}				

		http_check.send(null);

	}	

}







///////////////////////////////////

//////////////////////////////////////////////

function ShowCompLoginDiv(divId){

	if(divId=='loginDIV'){

	document.getElementById("loginDIV").style.display = 'block';

	document.getElementById("regsDIV").style.display = 'none';

	}else{

		document.getElementById("loginDIV").style.display = 'none';

	document.getElementById("regsDIV").style.display = 'block';

	}

}

///////////////////////////////////////////////////////////////////

function compuploadregst_home(){

	//alert("pawan");

	window.location="registration.php?Type=photo";

	window.event.returnValue=false;

	}

///////////////////////////////////////////////////////////////Upload 29 aug///////////////

function showUploadVideoDIV(){	

	

	//alert("pawan");

	

	var obj = document.getElementById("showUploadVideo");

	obj.style.display = 'block';

	//document.getElementById("video_file").disabled = false;

	document.getElementById("upVi").innerHTML = '<input type="file" name="video_file" id="video_file" tabindex="4" onchange="videoUpload_home(this);"/>'

	document.getElementById("dologin1").style.display='none';

	document.getElementById("VediologinDIV").style.display='none';

	document.getElementById("VideoregsDIV").style.display='none';

	document.getElementById("vErrMsg").style.display='none';



	//document.getElementById("country").disabled = true;

	

	//document.getElementById("reEmailErr").innerHTML = '';

	

	var width 			= pageWidth();	

	var height 			= pageHeight();	

	var left 			= leftPosition(); 

	var top 			= topPosition();

	var dialogwidth 	= obj.offsetWidth;

	var dialogheight 	= obj.offsetHeight;

	var topposition 	= top + (height / 2) - (dialogheight / 2);

	var leftposition 	= left + (width / 2) - (dialogwidth / 2);

	obj.style.top 		= topposition + "px";

	obj.style.left 		= leftposition + "px";

	

	var cntObj 	  		= document.getElementById(CONTENTDIV);

	var cntHeight 		= cntObj.offsetHeight;

	var cntWidth		= cntObj.offsetWidth;

		

	if(SCREENHEIGHT == '994'){

		

		if(cntHeight < 1000 && cntHeight > 950){

			cntHeight = SCREENHEIGHT - 10;	

		}else if(cntHeight > 1000){

			cntHeight = cntHeight;

		}else{

			cntHeight = SCREENHEIGHT - 140;

		}

	}else if(SCREENHEIGHT == '738'){

		

		if(cntHeight > 700  && cntHeight < 750){			

			cntHeight = SCREENHEIGHT;

		}else if(cntHeight > 750 ){			

			cntHeight = cntHeight;

		}else if(cntHeight < SCREENHEIGHT){

			cntHeight = SCREENHEIGHT - 140;

		}else{			

			cntHeight = SCREENHEIGHT;

		}

	}

	

	document.getElementById("maskDivMedia").style.height = cntHeight+"px";

	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";

	

	document.getElementById("div_loading").style.display = 'block';

}

////////////////////////////////////////////

function videoUpload_home(obj){

		//alert(fileVal);

		

		if(document.getElementById("vtitle").value==''){

		

	document.getElementById("errVdivcap").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>All fields are required";

	document.getElementById("vtitle").focus();

		return false;

		}

	else{

		document.getElementById("errVdivcap").innerHTML ='';

		

		}



		document.getElementById("vErrMsg").style.display='block';

	var fileVal = obj.value;

	//alert(fileVal);

	var ext 	= fileVal.substring(fileVal.lastIndexOf(".")+1,fileVal.length).toLowerCase();

	

	

	if(ext != 'flv' && ext != 'mp4' && ext != 'mpg' && ext != 'mpeg' && ext != 'wmv' && ext != 'mpeg4' && ext != 'mov'){		

		document.getElementById("vErrMsg").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>Format not supported";

		return false;		

	}else{

		

		document.getElementById("vErrMsg").innerHTML = '';

		

		

		$('#videoProgId')

			.ajaxStart(function(){

			//document.getElementById('viUplButton').disabled = true;

				$(this).show();

			})

			.ajaxComplete(function(){

			//document.getElementById('viUplButton').disabled = false;

				$(this).hide();

			});

	

			$.ajaxFileUpload

			(

				{

					url:'videoUpload_home.php',

					//alert(url);

					secureuri:false,

					fileElementId:'video_file',

					dataType: 'json',

					success: function (data, status)

					{

						if(typeof(data.error) != 'undefined')

						{

							if(data.error != ''){							

								//alert("data error :"+data.error);

								document.getElementById("vErrMsg").innerHTML = "<font color='#FFA537' face='Verdana' size='1'> try again.";

							}else{

								//alert('Your image has been uploaded successfully.');

								//alert(data.msg);//return false;

								var retMsg = data.msg;

								var responseTxt = retMsg.split('~~');

										//alert(responseTxt[0]);						

								if(responseTxt[0] == 'success'){

									

									//document.getElementById("hVidName").value = responseTxt[1];	

									//document.getElementById("hVidSize").value = responseTxt[2];										

									

									document.getElementById("video_file").disabled = true;

			document.getElementById("vErrMsg").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>Your video has been uploaded, now proceed further.";

							document.getElementById("dologin1").style.display = 'block';	

									

								}else if(responseTxt[0] == 'size' && responseTxt[1] == 'problem'){									

									document.getElementById("vErrMsg").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>Video size should not greater than 30Mb";									

								}

							}

						}

					},

					error: function (data, status, e)

					{

						//alert("error: "+e);

						document.getElementById("vErrMsg").innerHTML = "<font color='#FFA537' face='Verdana' size='1'> try again.";

					}

				}

			)		

			return false;

	}

}

/////////////////////////////////////////////////////////////

function ShowCompLoginVideoDiv(divId){

	if(divId=='VediologinDIV'){

	document.getElementById("VediologinDIV").style.display = 'block';

	document.getElementById("VideoregsDIV").style.display = 'none';

	}else{

		document.getElementById("VediologinDIV").style.display = 'none';

	document.getElementById("VideoregsDIV").style.display = 'block';

	}

}

/////////////////////////////////////////////////////////////////

function logincheckVideoUpload(){

	//alert("pawan");

	var vtitle  = document.getElementById("vtitle").value;	

	var errCnt 	= 0;

	var u_name  = document.getElementById("ust_name").value;

	//alert(u_name);

	u_name		= rm_trim(u_name);	

	if(u_name == ''){		

		errCnt++;

	}

	var u_pwd 	= document.getElementById("ust_pwd").value;

	u_pwd		= rm_trim(u_pwd);

	if(u_pwd == ''){

		errCnt++;

	}

	//alert(errCnt);return false;

	

	if(errCnt > 0){

		var message = "All fields are required";

		document.getElementById('errmsghomevideoid').innerHTML = message;

		return false;

	}else{

				

		document.getElementById('errmsghomevideoid').innerHTML = "";

		var url = "check-login-comp.php?ustname="+u_name+"&ustpass="+u_pwd+"&vtitle="+vtitle;



		//alert(url);//return false;

		http_check.open("GET", url, true);

		http_check.onreadystatechange = function test(){

			//alert(http_check.readyState);

			if(http_check.readyState == 4) {

				var response = http_check.responseText;

				//alert(response);return false;

				//document.write(response);

				if (response == "no"){

					var message = "Incorrect entry. Re-enter!";

					document.getElementById('errmsghomevideoid').innerHTML = message;

					return false;

				}

				else{

					//alert("pawan");

					//window.location="video-view.php";

					window.location="campaignVideo.php";

					window.event.returnValue=false;

					

					

					}

				

				

			}

		}				

		http_check.send(null);

	}	

}



///////////////////////////////////////////////

function compuploadregst_Video(){

	//alert("pawan");

	window.location="registration.php?Type=video";

	window.event.returnValue=false;

	}



///////////////////////////////////////////////////////////////upload Audio home 29 aug

///////////////////////////////////////////////////////////////



function showUploadAudioDIV(){	

	

	//alert("pawan");

	

	var obj = document.getElementById("showUploadAudio");

	obj.style.display = 'block';

	//document.getElementById("audio_file").disabled = false;

	document.getElementById("upAu").innerHTML = '<input type="file" name="audio_file" id="audio_file" onchange="audioUpload_home(this);" />'

	document.getElementById("dologin2").style.display='none';

	document.getElementById("AudiologinDIV").style.display='none';

	document.getElementById("AudioregsDIV").style.display='none';

	document.getElementById("audMaErrId").style.display='none';

	

	//document.getElementById("country").disabled = true;

	

	//document.getElementById("reEmailErr").innerHTML = '';

	

	var width 			= pageWidth();	

	var height 			= pageHeight();	

	var left 			= leftPosition(); 

	var top 			= topPosition();

	var dialogwidth 	= obj.offsetWidth;

	var dialogheight 	= obj.offsetHeight;

	var topposition 	= top + (height / 2) - (dialogheight / 2);

	var leftposition 	= left + (width / 2) - (dialogwidth / 2);

	obj.style.top 		= topposition + "px";

	obj.style.left 		= leftposition + "px";

	

	var cntObj 	  		= document.getElementById(CONTENTDIV);

	var cntHeight 		= cntObj.offsetHeight;

	var cntWidth		= cntObj.offsetWidth;

		

	if(SCREENHEIGHT == '994'){

		

		if(cntHeight < 1000 && cntHeight > 950){

			cntHeight = SCREENHEIGHT - 10;	

		}else if(cntHeight > 1000){

			cntHeight = cntHeight;

		}else{

			cntHeight = SCREENHEIGHT - 140;

		}

	}else if(SCREENHEIGHT == '738'){

		

		if(cntHeight > 700  && cntHeight < 750){			

			cntHeight = SCREENHEIGHT;

		}else if(cntHeight > 750 ){			

			cntHeight = cntHeight;

		}else if(cntHeight < SCREENHEIGHT){

			cntHeight = SCREENHEIGHT - 140;

		}else{			

			cntHeight = SCREENHEIGHT;

		}

	}

	

	document.getElementById("maskDivMedia").style.height = cntHeight+"px";

	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";

	

	document.getElementById("div_loading").style.display = 'block';

}

////////////////////////////////////////////

function audioUpload_home(obj){

	

	if(document.getElementById("audcam").value==''){

		

	document.getElementById("errdivcap").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>All fields are required";

	document.getElementById("audcam").focus();

		return false;

		}

	else{

		document.getElementById("errdivcap").innerHTML ='';

		

		}



	

	document.getElementById("audMaErrId").style.display='block';

		

	var fileVal = obj.value;

	var ext 	= fileVal.substring(fileVal.lastIndexOf(".")+1,fileVal.length).toLowerCase();

	

	if(ext != 'mp3' && ext != 'mp4' && ext != 'mov'){

		

		document.getElementById("audMaErrId").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>Format not supported";

		return false;

		

	}else{

				

		document.getElementById("audMaErrId").innerHTML = '';

		$('#auProgId')

			.ajaxStart(function(){

				//document.getElementById("soUplButton").disabled = true;

				$(this).show();				

			})

			.ajaxComplete(function(){

				//document.getElementById("soUplButton").disabled = false;

				$(this).hide();

			});

	

			$.ajaxFileUpload

			(

				{

					url:'audioSongUpload_home.php',

					secureuri:false,

					fileElementId:'audio_file',

					dataType: 'json',

					success: function (data, status)

					{

						if(typeof(data.error) != 'undefined')

						{

							if(data.error != ''){							

								//alert("data error :"+data.error);

								document.getElementById("audMaErrId").innerHTML = "<font color='#FFA537' face='Verdana' size='1'> try again.";

							}else{

								//alert('Your image has been uploaded successfully.');

								//alert(data.msg);return false;

								var retMsg = data.msg;

								var responseTxt = retMsg.split('~~');

															

								if(responseTxt[0] == 'success'){

									

									//document.getElementById("hAuNaId").value = responseTxt[1];	

									//document.getElementById("txtAudSi").value = responseTxt[2];

									

									document.getElementById("audio_file").disabled = true;

									

		document.getElementById("audMaErrId").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>Your song has been uploaded, now proceed further.";

		document.getElementById("dologin2").style.display = 'block';							

								}else if(responseTxt[0] == 'size' && responseTxt[1] == 'problem'){									

									document.getElementById("audMaErrId").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>Song size not greater than 10Mb";									

								}

							}

						}

					},

					error: function (data, status, e)

					{

						//alert("error: "+e);

						document.getElementById("audMaErrId").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>  try again.";

					}

				}

			)		

			return false;

	}

}

//////////////////////////////////////////////////////

function ShowCompLoginAudioDiv(divId){

	if(divId=='AudiologinDIV'){

	document.getElementById("AudiologinDIV").style.display = 'block';

	document.getElementById("AudioregsDIV").style.display = 'none';

	}else{

		document.getElementById("AudiologinDIV").style.display = 'none';

	document.getElementById("AudioregsDIV").style.display = 'block';

	}

}

//////////////////////////////////////////////////////

function logincheckAudioUpload(){

	//alert("pawan");

	var caption  = document.getElementById("audcam").value;	

	//alert(caption);

	var errCnt 	= 0;

	var u_name  = document.getElementById("u_name").value;

	//alert(u_name);

	u_name		= rm_trim(u_name);	

	if(u_name == ''){		

		errCnt++;

	}

	var u_pwd 	= document.getElementById("u_pwd").value;

	u_pwd		= rm_trim(u_pwd);

	if(u_pwd == ''){

		errCnt++;

	}

	//alert(errCnt);return false;

	

	if(errCnt > 0){

		var message = "All fields are required";

		document.getElementById('errmsghomeaudioid').innerHTML = message;

		return false;

	}else{

		//alert("loog");

		

		document.getElementById('errmsghomeaudioid').innerHTML = "";

		var url = "check-login-comp.php?username="+u_name+"&userpass="+u_pwd+"&caption="+caption;



		//alert(url);//return false;

		http_check.open("GET", url, true);

		http_check.onreadystatechange = function test(){

			//alert(http_check.readyState);

			if(http_check.readyState == 4) {

				var response = http_check.responseText;

				//alert(response);

				if (response == "no"){

					var message = "Incorrect entry. Re-enter!";

					document.getElementById('errmsghomeaudioid').innerHTML = message;

					return false;

				}

				else{

					

					//window.location="audio-view.php?alb_id="+response;

					window.location="campaignAudio.php";

					window.event.returnValue=false;

					

					}

				

				

			}

		}				

		http_check.send(null);

	}	

}



///////////////////////////////////////////////

///////////////////////////////////////////////

function compuploadregst_Audio(){

	//alert("pawan");

	window.location="registration.php?Type=audio";

	window.event.returnValue=false;

	}



///////////////////////////////////////////////////////



//////////function for slash user page added by dinesh start here////////////////////////////////////////////////



////////////////////////////function for login popup from slash user page/////////////////////////



function delLoginPopUp(tapDes,fId,showDiv){

	var obj 		  	= document.getElementById(showDiv);

	obj.style.display 	= 'block';

	var width 			= pageWidth();	

	var height 			= pageHeight();	

	var left 			= leftPosition(); 

	var top 			= topPosition();

	var dialogwidth 	= obj.offsetWidth;

	var dialogheight 	= obj.offsetHeight;

	var topposition 	= top + (height / 2) - (dialogheight / 2);

	var leftposition 	= left + (width / 2) - (dialogwidth / 2);

	obj.style.top 		= topposition + "px";

	obj.style.left 		= leftposition + "px";

	

	var cntObj 	  		= document.getElementById(CONTENTDIV);

	var cntHeight 		= cntObj.offsetHeight;

	var cntWidth		= cntObj.offsetWidth;

	

	if(cntHeight < SCREENHEIGHT){

		cntHeight = SCREENHEIGHT - 190;

		//alert(cntHeight);

	}

	if(cntWidth < SCREENWIDTH){

		cntWidth = SCREENWIDTH - 26;

	}

	

	document.getElementById("maskDivMedia").style.height = cntHeight+"px";

	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	

	document.getElementById("div_loading").style.display = 'block';	

	

	document.getElementById("tappdesc").value = tapDes;

	document.getElementById("fid").value = fId;

	

	var float_left = (SCREENWIDTH / 2) - 194;

	var float_top = (SCREENHEIGHT / 3) - 120;

	JSFX_FloatDiv(showDiv, float_left,float_top).floatIt();

	return false;

}





function openLoginPopUp(commDesc,typeId,showDiv){

	var obj 		  	= document.getElementById(showDiv);

	obj.style.display 	= 'block';

	var width 			= pageWidth();	

	var height 			= pageHeight();	

	var left 			= leftPosition(); 

	var top 			= topPosition();

	var dialogwidth 	= obj.offsetWidth;

	var dialogheight 	= obj.offsetHeight;

	var topposition 	= top + (height / 2) - (dialogheight / 2);

	var leftposition 	= left + (width / 2) - (dialogwidth / 2);

	obj.style.top 		= topposition + "px";

	obj.style.left 		= leftposition + "px";

	

	var cntObj 	  		= document.getElementById(CONTENTDIV);

	var cntHeight 		= cntObj.offsetHeight;

	var cntWidth		= cntObj.offsetWidth;

	

	if(cntHeight < SCREENHEIGHT){

		cntHeight = SCREENHEIGHT - 190;

		//alert(cntHeight);

	}

	if(cntWidth < SCREENWIDTH){

		cntWidth = SCREENWIDTH - 26;

	}

	

	document.getElementById("maskDivMedia").style.height = cntHeight+"px";

	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	

	document.getElementById("div_loading").style.display = 'block';	

	

	document.getElementById("commDesc").value 	= commDesc;

	document.getElementById("typeId").value 	= typeId;

	

	var float_left = (SCREENWIDTH / 2) - 194;

	var float_top = (SCREENHEIGHT / 3) - 120;

	JSFX_FloatDiv(showDiv, float_left,float_top).floatIt();

	return false;

}





////////////////////////////function end for login popup from slash user page//////////////////////

/////////////////////////////for tap//////////////////////////////////////////////////////////////////

 

/////////////////////////tap ends///////////////////////////////







////////////////////////////function for delete tappopup from slash user page/////////////////////////



////////////////////////////function for delete tappopup from slash user page/////////////////////////


 

////////////////////////////////////////////////function for add as frnd/////////////////////////////////////////////



function AddLoginPopUp(fandesc,ffId,showDiv){

	var obj 		  	= document.getElementById(showDiv);

	obj.style.display 	= 'block';

	var width 			= pageWidth();	

	var height 			= pageHeight();	

	var left 			= leftPosition(); 

	var top 			= topPosition();

	var dialogwidth 	= obj.offsetWidth;

	var dialogheight 	= obj.offsetHeight;

	var topposition 	= top + (height / 2) - (dialogheight / 2);

	var leftposition 	= left + (width / 2) - (dialogwidth / 2);

	obj.style.top 		= topposition + "px";

	obj.style.left 		= leftposition + "px";

	

	var cntObj 	  		= document.getElementById(CONTENTDIV);

	var cntHeight 		= cntObj.offsetHeight;

	var cntWidth		= cntObj.offsetWidth;

	

	if(cntHeight < SCREENHEIGHT){

		cntHeight = SCREENHEIGHT - 190;

		//alert(cntHeight);

	}

	if(cntWidth < SCREENWIDTH){

		cntWidth = SCREENWIDTH - 26;

	}

	

	document.getElementById("maskDivMedia").style.height = cntHeight+"px";

	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	

	document.getElementById("div_loading").style.display = 'block';	

	

	document.getElementById("fandesc").value = fandesc;

	document.getElementById("ffid").value = ffId;

	

	var float_left = (SCREENWIDTH / 2) - 194;

	var float_top = (SCREENHEIGHT / 3) - 120;

	JSFX_FloatDiv(showDiv, float_left,float_top).floatIt();

	return false;

}





///////////////////////////////////////////////add as frnd ends/////////////////////////////////////////////////////













function flagPopUpMedia(showDiv,id){

	
	//alert(document.getElementById(id).innerHTML);

	document.getElementById("flagId").value = '';

	document.getElementById("mTypeId").value	= id;

	document.getElementById("capId").value	=	document.getElementById(id).innerHTML;

	var obj 		  	= document.getElementById(showDiv);

	obj.style.display 	= 'block';

	

	var width 			= pageWidth();	

	var height 			= pageHeight();	

	var left 			= leftPosition(); 

	var top 			= topPosition();

	var dialogwidth 	= obj.offsetWidth;

	var dialogheight 	= obj.offsetHeight;

	var topposition 	= top + (height / 2) - (dialogheight / 2);

	var leftposition 	= left + (width / 2) - (dialogwidth / 2);

	obj.style.top 		= topposition + "px";

	obj.style.left 		= leftposition + "px";

	

	var cntObj 	  		= document.getElementById(CONTENTDIV);

	var cntHeight 		= cntObj.offsetHeight;

	var cntWidth		= cntObj.offsetWidth;

	

	

	if(SCREENHEIGHT == '994'){				

		cntHeight = SCREENHEIGHT - 140;

		SCREENWIDTH = cntWidth;

	}else if(SCREENHEIGHT == '738'){	

		if(cntHeight > SCREENHEIGHT){

			cntHeight = cntHeight;

		}else{

			cntHeight = SCREENHEIGHT - 140;

		}

	}

	

	document.getElementById("maskDivMedia").style.height = cntHeight+"px";

	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	

	document.getElementById("div_loading").style.display = 'block';

		

	var float_left = (SCREENWIDTH / 2) - 194;

	var float_top = (SCREENHEIGHT / 3) - 120;

	JSFX_FloatDiv(showDiv, float_left,float_top).floatIt();

	return false;

}

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

/*

function fanPhoCommentpostPopUp(id){

	//alert();

	var obj 		  	= document.getElementById(id);

	obj.style.display 	= 'block';

	//var dphoid			=phoId;//this is added by dinesh

	var width 			= pageWidth();	

	var height 			= pageHeight();	

	var left 			= leftPosition(); 

	var top 			= topPosition();

	var dialogwidth 	= obj.offsetWidth;

	var dialogheight 	= obj.offsetHeight;

	var topposition 	= top + (height / 2) - (dialogheight / 2);

	var leftposition 	= left + (width / 2) - (dialogwidth / 2);

	obj.style.top 		= topposition + "px";

	obj.style.left 		= leftposition + "px";

	

	var cntObj 	  		= document.getElementById(CONTENTDIV);

	var cntHeight 		= cntObj.offsetHeight;

	var cntWidth		= cntObj.offsetWidth;

	

	if(cntHeight < SCREENHEIGHT){

		cntHeight = SCREENHEIGHT - 190;

		//alert(cntHeight);

	}

	if(cntWidth < SCREENWIDTH){

		cntWidth = SCREENWIDTH - 26;

	}

	

	document.getElementById("maskDivMedia").style.height = cntHeight+"px";

	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	

	document.getElementById("div_loading").style.display = 'block';	

	

	//document.getElementById("hDelId").value = dId;

	//document.getElementById("hAlbId").value = dphoid;	

	

	var float_left = (SCREENWIDTH / 2) - 194;

	var float_top = (SCREENHEIGHT / 3) - 120;

	JSFX_FloatDiv(showDiv, float_left,float_top).floatIt();

	return false;

}

*/



/////////////////////function for delete photo,audio,video comm popup ends here/////////////////////////////////////



function beanextsuperstar(){	

	

	//alert("pawan");

	

	var obj = document.getElementById("beanextstar");

	obj.style.display = 'block';

	//document.getElementById("audio_file").disabled = false;

	var width 			= pageWidth();	

	var height 			= pageHeight();	

	var left 			= leftPosition(); 

	var top 			= topPosition();

	var dialogwidth 	= obj.offsetWidth;

	var dialogheight 	= obj.offsetHeight;

	var topposition 	= top + (height / 2) - (dialogheight / 2);

	var leftposition 	= left + (width / 2) - (dialogwidth / 2);

	obj.style.top 		= topposition + "px";

	obj.style.left 		= leftposition + "px";

	

	var cntObj 	  		= document.getElementById(CONTENTDIV);

	var cntHeight 		= cntObj.offsetHeight;

	var cntWidth		= cntObj.offsetWidth;

		

	if(SCREENHEIGHT == '994'){

		

		if(cntHeight < 1000 && cntHeight > 950){

			cntHeight = SCREENHEIGHT - 10;	

		}else if(cntHeight > 1000){

			cntHeight = cntHeight;

		}else{

			cntHeight = SCREENHEIGHT - 140;

		}

	}else if(SCREENHEIGHT == '738'){

		

		if(cntHeight > 700  && cntHeight < 750){			

			cntHeight = SCREENHEIGHT;

		}else if(cntHeight > 750 ){			

			cntHeight = cntHeight;

		}else if(cntHeight < SCREENHEIGHT){

			cntHeight = SCREENHEIGHT - 140;

		}else{			

			cntHeight = SCREENHEIGHT;

		}

	}

	

	document.getElementById("maskDivMedia").style.height = cntHeight+"px";

	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";

	

	document.getElementById("div_loading").style.display = 'block';

}





function bearockstar(){	

	

	//alert("pawan");

	

	var obj = document.getElementById("bearockstar");

	obj.style.display = 'block';

	//document.getElementById("audio_file").disabled = false;

	var width 			= pageWidth();	

	var height 			= pageHeight();	

	var left 			= leftPosition(); 

	var top 			= topPosition();

	var dialogwidth 	= obj.offsetWidth;

	var dialogheight 	= obj.offsetHeight;

	var topposition 	= top + (height / 2) - (dialogheight / 2);

	var leftposition 	= left + (width / 2) - (dialogwidth / 2);

	obj.style.top 		= topposition + "px";

	obj.style.left 		= leftposition + "px";

	

	var cntObj 	  		= document.getElementById(CONTENTDIV);

	var cntHeight 		= cntObj.offsetHeight;

	var cntWidth		= cntObj.offsetWidth;

		

	if(SCREENHEIGHT == '994'){

		

		if(cntHeight < 1000 && cntHeight > 950){

			cntHeight = SCREENHEIGHT - 10;	

		}else if(cntHeight > 1000){

			cntHeight = cntHeight;

		}else{

			cntHeight = SCREENHEIGHT - 140;

		}

	}else if(SCREENHEIGHT == '738'){

		

		if(cntHeight > 700  && cntHeight < 750){			

			cntHeight = SCREENHEIGHT;

		}else if(cntHeight > 750 ){			

			cntHeight = cntHeight;

		}else if(cntHeight < SCREENHEIGHT){

			cntHeight = SCREENHEIGHT - 140;

		}else{			

			cntHeight = SCREENHEIGHT;

		}

	}

	

	document.getElementById("maskDivMedia").style.height = cntHeight+"px";

	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";

	

	document.getElementById("div_loading").style.display = 'block';

}





function beasuperstar(){	

	

	//alert("pawan");

	

	var obj = document.getElementById("beasuperstar");

	obj.style.display = 'block';

	//document.getElementById("audio_file").disabled = false;

	var width 			= pageWidth();	

	var height 			= pageHeight();	

	var left 			= leftPosition(); 

	var top 			= topPosition();

	var dialogwidth 	= obj.offsetWidth;

	var dialogheight 	= obj.offsetHeight;

	var topposition 	= top + (height / 2) - (dialogheight / 2);

	var leftposition 	= left + (width / 2) - (dialogwidth / 2);

	obj.style.top 		= topposition + "px";

	obj.style.left 		= leftposition + "px";

	

	var cntObj 	  		= document.getElementById(CONTENTDIV);

	var cntHeight 		= cntObj.offsetHeight;

	var cntWidth		= cntObj.offsetWidth;

		

	if(SCREENHEIGHT == '994'){

		

		if(cntHeight < 1000 && cntHeight > 950){

			cntHeight = SCREENHEIGHT - 10;	

		}else if(cntHeight > 1000){

			cntHeight = cntHeight;

		}else{

			cntHeight = SCREENHEIGHT - 140;

		}

	}else if(SCREENHEIGHT == '738'){

		

		if(cntHeight > 700  && cntHeight < 750){			

			cntHeight = SCREENHEIGHT;

		}else if(cntHeight > 750 ){			

			cntHeight = cntHeight;

		}else if(cntHeight < SCREENHEIGHT){

			cntHeight = SCREENHEIGHT - 140;

		}else{			

			cntHeight = SCREENHEIGHT;

		}

	}

	

	document.getElementById("maskDivMedia").style.height = cntHeight+"px";

	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";

	

	document.getElementById("div_loading").style.display = 'block';

}







//////////function for slash user page added by dinesh ends here////////////////////////////////////////////////





//This code is for upload profile image

function proImgPopUp(divId,relativeDivId){
   	var obj 		  	= document.getElementById(divId);
  	var relObj		= document.getElementById(relativeDivId);
 	var divPos 		= GetLeftTopPosition(relObj);
   	var posBody 	= divPos.split('::');
	var divLeft 	= parseInt(posBody[0]);
	var divTop 		= parseInt(posBody[1]);
	var openDivLeft = (divLeft+200);
	var openDivTop 	= (divTop);
	obj.style.top 	  = openDivTop+'px';
	obj.style.left 	  = openDivLeft+'px';
	//obj.style.display 	= 'block';
	//alert('hiiiiiiii');
  	$("#"+divId).fadeIn(2000);
 	var det = getPageSize();
	cntWidth = det[0];
	cntHeight= det[1];
	document.getElementById("maskDivMedia").style.height = cntHeight+"px";
	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";	
	//document.getElementById("div_loading").style.display = 'block';	
	$("#div_loading").fadeIn(2000);
	return false;
}



function UploadAudioFMDIV(){	

	

	//alert("pawan");

	

	var obj = document.getElementById("showUploadAudioFM");

	obj.style.display = 'block';

	

	document.getElementById("upAu").innerHTML = '<input type="file" name="audio_file" id="audio_file" onchange="audioUpload_FMradio(this);" />'

	document.getElementById("dologin2").style.display='none';

	document.getElementById("AudiologinDIV").style.display='none';

	document.getElementById("AudioregsDIV").style.display='none';

	document.getElementById("audMaErrId").style.display='none';

	

	var width 			= pageWidth();	

	var height 			= pageHeight();	

	var left 			= leftPosition(); 

	var top 			= topPosition();

	var dialogwidth 	= obj.offsetWidth;

	var dialogheight 	= obj.offsetHeight;

	var topposition 	= top + (height / 2) - (dialogheight / 2);

	var leftposition 	= left + (width / 2) - (dialogwidth / 2);

	obj.style.top 		= topposition + "px";

	obj.style.left 		= leftposition + "px";

	

	var cntObj 	  		= document.getElementById(CONTENTDIV);

	var cntHeight 		= cntObj.offsetHeight;

	var cntWidth		= cntObj.offsetWidth;

		

	if(SCREENHEIGHT == '994'){

		

		if(cntHeight < 1000 && cntHeight > 950){

			cntHeight = SCREENHEIGHT - 10;	

		}else if(cntHeight > 1000){

			cntHeight = cntHeight;

		}else{

			cntHeight = SCREENHEIGHT - 140;

		}

	}else if(SCREENHEIGHT == '738'){

		

		if(cntHeight > 700  && cntHeight < 750){			

			cntHeight = SCREENHEIGHT;

		}else if(cntHeight > 750 ){			

			cntHeight = cntHeight;

		}else if(cntHeight < SCREENHEIGHT){

			cntHeight = SCREENHEIGHT - 140;

		}else{			

			cntHeight = SCREENHEIGHT;

		}

	}

	

	document.getElementById("maskDivMedia").style.height = cntHeight+"px";

	document.getElementById("maskDivMedia").style.width  = cntWidth+"px";

	

	document.getElementById("div_loading").style.display = 'block';

	var float_left = (SCREENWIDTH / 2) - 194;

	var float_top = (SCREENHEIGHT / 3) - 120;

	JSFX_FloatDiv('showUploadAudioFM', float_left,float_top).floatIt();

	

}

////////////////////////////////////////////

function audioUpload_FMradio(obj){

	

	if(document.getElementById("audcam").value==''){

		//alert("pawan");

	document.getElementById("errdivcap").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>All fields are required";

	document.getElementById("audcam").focus();

		return false;

		}

	else{

		document.getElementById("errdivcap").innerHTML ='';

		

		}



	var caption=document.getElementById("audcam").value;

	document.getElementById("audMaErrId").style.display='block';

		

	var fileVal = obj.value;

	var ext 	= fileVal.substring(fileVal.lastIndexOf(".")+1,fileVal.length).toLowerCase();

	

	if(ext != 'mp3' && ext != 'mp4' && ext != 'mov'){

		

		document.getElementById("audMaErrId").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>Format not supported";

		return false;

		

	}else{

				

		document.getElementById("audMaErrId").innerHTML = '';

		$('#auProgId')

			.ajaxStart(function(){

				//document.getElementById("soUplButton").disabled = true;

				$(this).show();				

			})

			.ajaxComplete(function(){

				//document.getElementById("soUplButton").disabled = false;

				$(this).hide();

			});

	

			$.ajaxFileUpload

			(

				{

					url:"fmaudio_upload.php?caption="+caption,

					secureuri:false,

					fileElementId:'audio_file',

					dataType: 'json',

					success: function (data, status)

					{

						if(typeof(data.error) != 'undefined')

						{

							if(data.error != ''){							

								alert("data error :"+data.error);

								document.getElementById("audMaErrId").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>  try again.";

							}else{

								//alert('Your image has been uploaded successfully.');

								//alert(data.msg);return false;

								var retMsg = data.msg;

								var responseTxt = retMsg.split('~~');

									//alert(responseTxt[0]);						

								if(responseTxt[0] == 'success'){

									

									//document.getElementById("hAuNaId").value = responseTxt[1];	

									//document.getElementById("txtAudSi").value = responseTxt[2];

									

									document.getElementById("audio_file").disabled = true;

									

		document.getElementById("audMaErrId").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>Your song has been uploaded, now proceed further.";

		document.getElementById("dologin2").style.display = 'block';							

								}else if(responseTxt[0] == 'size' && responseTxt[1] == 'problem'){									

									document.getElementById("audMaErrId").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>Song size not greater than 10Mb";									

								}

							}

						}

					},

					error: function (data, status, e)

					{

						//alert("error: "+e);

						document.getElementById("audMaErrId").innerHTML = "<font color='#FFA537' face='Verdana' size='1'>  try again.";

					}

				}

			)		

			return false;

	}

}

//////////////////////////////////////////////////////

//////////////////////////////////////////////////////

function logincheckFMUpload(){

	//alert("pawan");

	var caption  = document.getElementById("audcam").value;	

	//alert(caption);

	var errCnt 	= 0;

	var u_name  = document.getElementById("u_name").value;

	//alert(u_name);

	u_name		= rm_trim(u_name);	

	if(u_name == ''){		

		errCnt++;

	}

	var u_pwd 	= document.getElementById("u_pwd").value;

	u_pwd		= rm_trim(u_pwd);

	if(u_pwd == ''){

		errCnt++;

	}

	//alert(errCnt);return false;

	

	if(errCnt > 0){

		var message = "All fields are required";

		document.getElementById('errmsghomeaudioid').innerHTML = message;

		return false;

	}else{

		//alert("loog");

		

		document.getElementById('errmsghomeaudioid').innerHTML = "";

		var url = "check-login-comp.php?Fname="+u_name+"&fpass="+u_pwd+"&caption="+caption;



		//alert(url);//return false;

		http_check.open("GET", url, true);

		http_check.onreadystatechange = function test(){

			//alert(http_check.readyState);

			if(http_check.readyState == 4) {

				var response = http_check.responseText;

				//alert(response);

				if (response == "no"){

					var message = "Incorrect entry. Re-enter!";

					document.getElementById('errmsghomeaudioid').innerHTML = message;

					return false;

				}

				else{

					

					//window.location="audio-view.php?alb_id="+response;

					window.location="fmaudio.php";

					window.event.returnValue=false;

					

					}

				

				

			}

		}				

		http_check.send(null);

	}	

}

function closeFMMsgBoxAudio(divId){

	document.getElementById(divId).style.display = 'none';

	document.getElementById("div_loading").style.display = 'none';

	window.location="fmaudio.php";

	window.event.returnValue=false;

}



///////////////////////////////////////////////



////////////////////Chat////////////////////

function pausecomp(millis) 

{

var date = new Date();

var curDate = null;

do { curDate = new Date(); } 

while(curDate-date < millis);



} 



function set_position(a) {

	document.getElementById("window_position").value='';

	str_chat="chat_output.php?act=open&cwname="+a;

	common_ajax_pos(str_chat);

}

function position_handle(aa) {

	//alert("aa"+aa.responseText);

						document.getElementById("window_position").value=aa.responseText;

						/////////////////////////ADD Code Here///////////////////////////////////

						pos_list=document.getElementById("window_position").value.split(",");

//							alert(document.getElementById("window_position").value);

						MinLeft=0;

						MinTop=0;

						Login_Status='';

						Pop_Msg='';

						for(i=0;i<pos_list.length;i++) {

								position=pos_list[i].split(":");

								//alert(position[0]);

								if(position[0]=="cwmaxleft") {

									MinLeft=position[1];

								}

								if(position[0]=="cwmaxtop") {

									MinTop=position[1];					

								}

								if(position[0]=="login_status") {

									Login_Status=position[1];

								}

								if(position[0]=="Pop_Msg") {

									Pop_Msg=position[1];

								}

						}

						

						minw=a+"Min";

						maxw=a+"Max";

						//	alert(" Test 1");

						document.getElementById(minw).style.display='none';

						

						//alert("Window name :-" + maxw + " Is exists :-" + obj);

						

						

						

						//	alert("test 3");

						var from_top=0;				 /// top  chat window position

						left_val=parseInt(MinLeft);  /// left chat window position

						

						if(screen.width == 800 && screen.height == 600){

						from_top = parseInt(screen.height) - 430;

						left_val=parseInt(MinLeft)-315;

						}

						else if(screen.width == 1024 && screen.height == 768){

						from_top = parseInt(screen.height) - 420;		

						left_val=parseInt(MinLeft)-120;		

						}

						else if(screen.width == 1152 && screen.height == 864){

						from_top = parseInt(screen.height) - 440;

						left_val=parseInt(MinLeft)-57;				

						}

						else if(screen.width == 1280 && screen.height == 600){

						from_top = parseInt(screen.height) - 410;	

						left_val=parseInt(MinLeft)+10;						

						}

						else if(screen.width == 1280 && screen.height == 720){

						from_top = parseInt(screen.height) - 420;

						left_val=parseInt(MinLeft)+10;

						}

						else if(screen.width == 1280 && screen.height == 768){

						from_top = parseInt(screen.height) - 420;

						left_val=parseInt(MinLeft)+1;

						}

						else if(screen.width == 1280 && screen.height == 800){

						from_top = parseInt(screen.height) - 440;

						left_val=parseInt(MinLeft)+1;

						}

						else if(screen.width == 1280 && screen.height == 960){

						from_top = parseInt(screen.height) - 420;

						left_val=parseInt(MinLeft)+8;

						}

						else if(screen.width == 1280 && screen.height == 1024){

						from_top = parseInt(screen.height) - 420;

						left_val=parseInt(MinLeft)+8;

						}

						else if(screen.width == 1400 && screen.height == 1050){

						from_top = parseInt(screen.height) - 520;

						left_val=parseInt(MinLeft)+70;

						}	

						else if(screen.width == 1440 && screen.height == 900){

						from_top = parseInt(MinTop) - 125;

						left_val=parseInt(MinLeft)+100;

						}	

						

						//	alert("test 4");

						/////////////////////////////////////////////////////Position end

						

						//alert("Login Status" + Login_Status + " : " + a);

						

						

						//	alert("Login Status" + Login_Status.length + " : " + a);

						//	alert(Pop_Msg);

						//alert("Left Pos : " + left_val + " , Top : " + from_top + "Screen Height : " + screen.height);

						if(Login_Status=="false" || Login_Status=="")  {

						/////////Maximize Chat Window Position		

						maxw=a+"Max";

						//alert(maxw);

						var obj = document.getElementById(maxw);

						//alert("Login" + left_val);

						obj.style.position = 'fixed';

						obj.style.left = left_val + 'px';

						obj.style.position = 'absolute';	

						//alert("Login call " + a + ":" + b);

						login(a,b);

						obj.style.display = 'block';						

						}

						else {

						/////////Maximize Chat Window Position

						//alert("Else ");

						maxw=a+"Max";						

						var obj = document.getElementById(maxw);

						obj.style.position = 'fixed';

						obj.style.left = left_val+'px';

						obj.style.position = 'absolute';

						obj.style.display = 'block';

						

						document.getElementById(a+'login').style.display='none';

						document.getElementById(a+'chat').style.display='block';

						//if(login_status111!="auto") {

						document.getElementById(a+'messages').innerHTML=Pop_Msg;

						//}

						}

}

function Chat_Enter1(a,b){	



	str_chat="chat_output.php?act=chatmax&cwname="+a;

	common_ajax(str_chat);

	

	//alert(" User in logon mode " + a);

	i=1;

	

	url="chat_output.php";

	pars="act=open&cwname="+a;

	var ajax = new Ajax.Request(url, {method: 'post', parameters: pars, onComplete: position_handle(a,b)});



//alert(document.getElementById("window_position").value);

/*	str_chat="chat_output.php?act=open&cwname="+a;

	common_ajax_pos(str_chat,a,b);

	for(yy=0;yy>=10000;yy++) {

		if(document.getElementById("window_position").value!="") {

			break;

		}

	} */

	/*while(1) {

		alert('In Process .....');

		set_position(a);		

		if(document.getElementById("window_position").value!="") {

			//alert("Positin found .... " + document.getElementById("window_position").value);

			break;

		}

		i++;

	} */ 

	



}





function Chat_min1(a,b,Min_Left,Min_Top){	



	//alert("Min Left"+Min_Left+"Min Top"+Min_Top);

	if(b=="true") {

		maxw=a+"Max";

		minw=a+"Min";

		///////////////////////////////////////////////////

		//alert("Active min user name " + a);

		str_chat="chat_output.php?act=chatmin&cwname="+a;

		common_ajax(str_chat);

		//alert("AAAAA TESTING 1");

		$i=1;

		set_position(a);	

		while(1) {

			alert('In Process .....');

			//set_position(a);			

			if(document.getElementById("window_position").value!="") {

				//alert("Positin found .... " + document.getElementById("window_position").value);

				break;

			}

		i++;

		}



//alert("Min Window Position " + document.getElementById("window_position").value);

		///////////////////////////////////////////////////

		

		pos_list=document.getElementById("window_position").value.split(",");

		for(i=0;i<pos_list.length;i++) {

				position=pos_list[i].split(":");

				if(position[0]=="cwminleft") {

					Min_Left=position[1];

				}

				if(position[0]=="cwmintop") {

					Min_Top=position[1];

				}				

		}



	

		var from_top=0;				 /// top  chat window position

		left_val=parseInt(Min_Left);  /// left chat window position

	

			//alert("height: "+parseInt(cntHeight));

		if(screen.width == 800 && screen.height == 600){

			from_top = parseInt(screen.height) - (430-200+10);

			left_val=parseInt(Min_Left)-315;

		}

		else if(screen.width == 1024 && screen.height == 768){

			from_top = parseInt(screen.height) - (420-200);		

			left_val=parseInt(Min_Left)-120;		

		}

		else if(screen.width == 1152 && screen.height == 864){

			from_top = parseInt(screen.height) - (440-200);

			left_val=parseInt(Min_Left)-57;				

		}

		else if(screen.width == 1280 && screen.height == 600){

			from_top = parseInt(screen.height) - (410-200+10);	

			left_val=parseInt(Min_Left)+10;						

		}

		else if(screen.width == 1280 && screen.height == 720){

			from_top = parseInt(screen.height) - (420-200);

			left_val=parseInt(Min_Left)+10;

		}

		else if(screen.width == 1280 && screen.height == 768){

			from_top = parseInt(screen.height) - (420-200);

			left_val=parseInt(Min_Left)+1;

		}

		else if(screen.width == 1280 && screen.height == 800){

			from_top = parseInt(screen.height) - (440-200);

			left_val=parseInt(MinLeft)+1;

		}

		else if(screen.width == 1280 && screen.height == 960){

			from_top = parseInt(screen.height) - (420-200);

			left_val=parseInt(Min_Left)+8;

		}

		else if(screen.width == 1280 && screen.height == 1024){

			from_top = parseInt(screen.height) - (420-200);

			left_val=parseInt(Min_Left)+8;

		}

		else if(screen.width == 1400 && screen.height == 1050){

			from_top = parseInt(screen.height) - (520-200);

			left_val=parseInt(Min_Left)+70;

		}	

		else if(screen.width == 1440 && screen.height == 900){

			from_top = parseInt(screen.height) - (425-200);

			left_val=parseInt(Min_Left)+88;

		}	







		document.getElementById(maxw).style.display='none';

		

		/////////Minimize Chat Window Position

		var obj = document.getElementById(minw);

		obj.style.position = 'fixed';

		obj.style.left = left_val+'px';

		obj.style.position = 'absolute';		

		obj.style.display = 'block';



		str_chat="chat_output.php?act=chatmin&cwname="+a;

		common_ajax(str_chat);

		document.getElementById("window_position").value='';

	}

}