/*
*************************************************************************
*	Sample of Open Window 												*
*************************************************************************
function openADViewWindow(ad_id, width, height){
	if(ad_id!=0){
		var args = 'width='+(String)(parseFloat(width)+20)+',height='+(String)(parseFloat(height)+20)+',status=0,address=0,resize=0';
		var popwindow = window.open('index.php?view=ad_view&ad_id='+ad_id,'ad_stat', args);
		if(!popwindow){
			alert("Your POP UP Blocker blocking a new window\n\nPlease disable any POP UP Blocker,\nor hold down CNTRL key while clicking on button/link");
		}
	}else{
		alert('Invalid operation !!');
	}
}
*************************************************************************


*************************************************************************
*	Sample of Ajax Usage												*
*************************************************************************
function toggle_user_status(user_id, stat){
	if(user_id!=0 && (stat==0 || stat==1)){
		new ajax ('ajax.php', {postBody: 'method=toggle_user_status&user_id='+user_id+'&stat='+stat, onComplete: toggle_user_status_callback});
		document.getElementById("WAIT").style.left = (Screen.getViewportWidth()/2 - (300/2))+"px";
		document.getElementById("WAIT").style.top = (Screen.getScrollTop()+(Screen.getViewportHeight()/2)-50)+"px";
		document.getElementById("WAIT").style.display = '';
		document.getElementById("COVER").style.display = '';
		document.getElementById("COVER").style.height = Screen.getDocumentHeight()+'px';
	}else{
		alert("Invalid operation. Please try later on !!");
	}
}

function toggle_user_status_callback(request, uservar){
	document.getElementById("WAIT").style.display = 'none';//$("WAIT").hide();
	document.getElementById("COVER").style.display = 'none';
	if(request!=null){
		if(request.responseText=="OK"){
			alert("The users status has been changed successfully !!\n\nYou need to refresh this page to see the updated status");
			window.location.reload();
		}else{
			alert("We were not able to process your request\n\nPlease try later on");
		}
	}else{
		alert("We were not able to process your request\n\nPlease try later on");
	}
}
*************************************************************************
*/
/*===========Prevent Images From Being Right Clickable=================*/
/*var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
	(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")*/
/*===========Prevent Images From Being Right Clickable=================*/
/*===========Function For Showing City according to Country=================*/
function showStates(country,stateComboRowID,stateTextboxRowID,stateComboID,stateTextboxID){

	
	var userVarArray=new Array();
	userVarArray[0]=stateComboRowID;
	userVarArray[1]=stateTextboxRowID;
	userVarArray[2]=stateComboID;
	userVarArray[3]=stateTextboxID;

new ajax ('ajax.php', {postBody: 'method=displaystate&country='+country, onComplete: showStates_callback,userVariable: userVarArray});
}

function showStates_callback(request,uservar){
	if(request!=null){
		
		
			
			
			if(request.responseText!=''){
				
							
							var stateComboRowID=uservar[0];
							var stateTextboxRowID=uservar[1];
							var stateComboID=uservar[2];
							var stateTextboxID=uservar[3];
														
							if(request.responseText!='statetextfield'){
										
										$(stateComboRowID).show();
										$(stateTextboxRowID).hide();
															
										clearCombo(stateComboID);
										cntrl = document.getElementById(stateComboID);
										var newOption, NameValuePair;
										var tmpArr = request.responseText.split("^");
																			
										for(i=0;i<tmpArr.length;i++){
											NameValuePair = tmpArr[i].split("|");
											newOption = new Option();
											newOption.value = NameValuePair[1];
											newOption.text = NameValuePair[1];
											cntrl.options[cntrl.options.length]=newOption;
										}
										
							}else{
										$(stateTextboxRowID).show();
										$(stateComboRowID).hide();
										$(stateTextboxID).value='';
							}
						
						
			}
			
			
		
	}else{
		alert("We were not able to process your request\n\nPlease try later on");
	}
}

function clearCombo(ComboDropDown){
	
	var cntrl = document.getElementById(ComboDropDown);
	while(cntrl.options.length>0){
		cntrl.options[cntrl.options.length-1] = null;
	}
	var newOption = new Option();
	newOption.value = 0;
	newOption.text = "--Select State--";
	cntrl.options[cntrl.options.length]=newOption;
}
/*=====================================================================*/
function changeFieldValue(tablename,fieldname,fieldvalue,autoid,messagediv,messagetext){
	
	var userVarArray=new Array();
	userVarArray[0]=messagediv;
	userVarArray[1]=messagetext;
	
	new ajax ('ajax.php', {postBody: 'method=changefield&tablename='+tablename+'&fieldname='+fieldname+'&fieldvalue='+fieldvalue+'&autoid='+autoid, onComplete: changeFieldValue_callback,userVariable: userVarArray});
	
}

function changeFieldValue_callback(request,uservar){
	if(request!=null){
		
		
			
			
			if(request.responseText!=''){
				
				
						var messagediv=uservar[0];
						var messagetext=uservar[1];
						
						
						var success_icon="images/success_icon.gif";
						var messagestring="<table cellspacing=0 cellpadding=0 border=0><tr><td align='left' width='24' valign='top'><img src='"+success_icon+"'></td><td style='font-family: Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif; font-size: 13px; color:#006600; font-weight:normal'>"+messagetext+"</td></tr></table>";
						
						$(messagediv).innerHTML=messagestring;
							
					
			}
			
			
		
	}else{
		alert("We were not able to process your request\n\nPlease try later on");
	}
}
//=============toggle tab images=============
function toggleTabImages(currentImageID,currentImageSource,otherImageID,otherImageSource){
	
	$(currentImageID).src=currentImageSource;
	$(otherImageID).src=otherImageSource;

}

//========= file upload callback ==========
function album_image_upload_done(result){
	$('div_uploading_wait').hide();
	$('displaycell').show();
	$('OKButton').show();
	if(result==1){
			$('displaycell').innerHTML="File uploaded succesfully";
	}else{
		    $('displaycell').innerHTML="File Not uploaded";
	}
}

function showUploadResultWindow(){
	
	document.getElementById("UPLOADWINDOWDIV").style.left = (Screen.getViewportWidth()/2 - (320/2))+"px";
	document.getElementById("UPLOADWINDOWDIV").style.top = (Screen.getScrollTop()+(Screen.getViewportHeight()/2)-200)+"px";
	document.getElementById("UPLOADWINDOWDIV").style.display = '';
	document.getElementById("COVER").style.display = '';
	document.getElementById("COVER").style.height = Screen.getDocumentHeight()+'px';
}

function hideUploadResultWindow(redirectURL){
	document.getElementById("UPLOADWINDOWDIV").style.display = 'none';
	document.getElementById("COVER").style.display = 'none';
	if(redirectURL!='')
	location.href=redirectURL;
}

//========= file upload callback ==========

//===========fashion login popup============
function showFashionLoginWindow(){
	
	document.getElementById("FASHIONLOGINWINDOWDIV").style.left = (Screen.getViewportWidth()/2 - (560/2))+"px";
	document.getElementById("FASHIONLOGINWINDOWDIV").style.top = (Screen.getScrollTop()+(Screen.getViewportHeight()/2)-200)+"px";
	document.getElementById("FASHIONLOGINWINDOWDIV").style.display = '';
	document.getElementById("COVER").style.display = '';
	document.getElementById("COVER").style.height = Screen.getDocumentHeight()+'px';
}

function hideFashionLoginWindow(redirectURL){
	document.getElementById("FASHIONLOGINWINDOWDIV").style.display = 'none';
	document.getElementById("COVER").style.display = 'none';
	if(redirectURL!='')
	location.href=redirectURL;
}

function showFashionLoginError(errorMsg){
	document.getElementById("messageCell").innerHTML = errorMsg;
}
//===========fashion login popup============
//=========automated music popup functions===============
function popup_music_player(){
	
window.open("music_player.php","MusicPlayer","toolbar=0,scrollbars=0,location=0,status=0,menubars=0,resizable=0,width=576,height=148,top=200,left=200,maximize=no"); 

} 

function closeMusicPlayer(){
	
	var userVarArray=new Array();
	new ajax ('ajax.php', {postBody: 'method=changemusicsession'});
	
}

//=========automated music popup functions===============
