    function SignOut(url,target,functionid,w,h) {
		centerDivAbs(target,w,h);
		xmlHttpRequestCallFunctionCenter(url,target,functionid,w,h);
	}

//Main popup
    function showMainPopupWithCSSAndJS(url,w,h,css,js){
        loadCSSAndJSAndCallback(url,w,h,css,js,showMainPopup);
    }

    function loadCSSAndJSAndCallback(url,w,h,css,js,fnCallback){
        if(css){
            var headID = document.getElementsByTagName("head")[0];
            var cssNode = document.createElement('link');
            cssNode.type = 'text/css';
            //cssNode.onload=cssLoaded(url,w,h,js,fnCallback);
            cssNode.rel = 'stylesheet';
            cssNode.href = css;
            //cssNode.media = 'screen';
            headID.appendChild(cssNode);     

            cssLoaded(url,w,h,js,fnCallback);
        }
        else{
            cssLoaded(url,w,h,js,fnCallback);
        }
    }

    function cssLoaded(url,w,h,js,fnCallback){
        if(js){
            var headID = document.getElementsByTagName("head")[0];
            var newScript = document.createElement('script');
            newScript.type = 'text/javascript';
            newScript.onload=scriptLoaded(url,w,h,fnCallback);
            newScript.src = js;
            headID.appendChild(newScript);        
        }
        else{
            scriptLoaded(url,w,h,fnCallback);
        }
    }

    function scriptLoaded(url,w,h,fnCallback){
        fnCallback(url,w,h);
    }

	
	function showMainPopup(url,w,h){
		divReg = document.getElementById('divMainPopupBackground');
		divReg.style.display = 'block';
		divReg.style.top = 0;
		divReg.style.left = 0; 
		divReg.style.width = '100%'; 
		divReg.style.height = '100%'; 
	
		centerDivAbs('divMainPopup',w,h);
		//xmlHttpRequestCall(url,'divMainPopup');
		xmlHttpRequestCallCenter(url, 'divMainPopup', w,h);
		
		if(document.getElementById("main_123"))
		{
            try{	
			    var mov = thisMovie("main_123");
			    
			    mov.pauseFlashVideo();
			}catch(e){
			}
		}
	}

	function closeMainPopup(){
		document.getElementById('divMainPopup').style.display = 'none';

		divReg = document.getElementById('divMainPopupBackground');
		divReg.style.width = '1px';
		divReg.style.height = '1px';
		divReg.style.display = 'none';
	
		var FObj = document.getElementById("main_123");
		if(FObj != null)
		{
			var mov = (thisMovie("main_123"));
			if(mov.dialogBoxClosed)
			    mov.dialogBoxClosed();
		}
	}
/////////////////////////////////////////////////////////////
    function showProfileStepsPopupCSSAndJS(url,css,js){
        loadCSSAndJSAndCallback(url,0,0,css,js,showProfileStepsPopup);
    }

	function showProfileStepsPopup(url,w,h){
		divReg = document.getElementById('divMainPopupBackground');
		divReg.style.display = 'block';
		divReg.style.top = 0;
		divReg.style.left = 0; 
		divReg.style.width = '100%'; 
		divReg.style.height = '100%'; 
	
		
		//divAlign = document.getElementById('div_prf_leftside');
		divAlign = document.getElementById('mainContent');
		absOffsetX = findAbsPosX(divAlign);
		absOffsetY = findAbsPosY(divAlign);
		divPopup = document.getElementById('divMainPopup');
		divPopup.style.left = absOffsetX + 'px';
		divPopup.style.top = absOffsetY + 'px';
		
		
		//centerDivAbs('divMainPopup',1000,370);
		xmlHttpRequestCallCenter(url,'divMainPopup',1000,370);
	}
//////////////////////////////////////////////////////////////
function closePopup(){
	closepopup('popupcontent');
}
/////////////////////////////////////////////////////////////

function showSavePopup(itemID,linkID,assetType){
    url = '/index.php?method=showSavePopup';
    url += '&itemID='+itemID;
    url += '&linkID='+linkID;
    url += '&assetType='+assetType;
    
	centerDivAbs('popupcontent',350,150);
	showpopup('popupcontent');
	xmlHttpRequestCallCenter(url,'popupcontent',350,150);
}

function showSavePopupItem(itemID, assetType) {
    showSavePopup(itemID, '', assetType);
}


function clearSavePopup() {
	document.getElementById('userAssetName').value = "";
	document.getElementById('userAssetTags').value = "";
	//document.getElementById('subscribe').checked  = false;
}

function saveItem(itemID,linkID,assetType) {
		
		var userAssetID = document.getElementById('userAssetID').value;
		var userAssetName = document.getElementById('userAssetName').value;
		
		if(userAssetID == "" && userAssetName == "") {
		   alert("Select your list or create a new wishlist");
		}else {		
			url  = '/index.php?method=saveitem';
			url += '&itemID='+itemID;
			url += '&linkID='+linkID;
			url += '&assetType='+assetType;
			url += '&userAssetID='+userAssetID;
			url += '&userAssetName='+userAssetName;
			//url += '&tags='+document.getElementById('userAssetTags').value;
			//url += '&subscribe='+document.getElementById('subscribe').value;

    		xmlHttpRequestCall(url,'popupcontent');
		}
}
/* -- Share Popup Metods : ============================================================= */

function showSharePopupURL(id,type,shareURL){
    url = '/index.php?method=showSharePopup';
    url += '&ID='+id;
    url += '&type='+type;
    url += '&url='+escape(shareURL);

	centerDivAbs('popupcontent',350,150);
	showpopup('popupcontent');
	xmlHttpRequestCallCenter(url,'popupcontent',350,150);
}

function showSharePopup(id,type){
    url = '/index.php?method=showSharePopup';
    url += '&ID='+id;
    url += '&type='+type;

	centerDivAbs('popupcontent',350,150);
	showpopup('popupcontent');
	xmlHttpRequestCallCenter(url,'popupcontent',350,150);
}


function onFieldFocus(obj,clearValue) {
    if(document.getElementById(obj).value == clearValue){
        document.getElementById(obj).value = "";
    }
    else{
        document.getElementById(obj).select();
    }
}

function onFieldBlur(obj,clearValue) {
    if(document.getElementById(obj).value == ""){
        document.getElementById(obj).value = clearValue;
    }
}


/*
function focusSharePopupFields(obj) {
    var field = document.getElementById(obj);
	if(field.value == 'email' || field.value == 'YOUR NAME')	
        field.value = "";
}

function blurSharePopupFields(obj) {
    var field = document.getElementById(obj);
    if(obj == 'to' && field.value == "")
        field.value = "email";
    if(obj == 'email' && field.value == "")
        field.value = "ENTER RECIPIENT'S EMAIL";
    if(obj == 'name' && field.value == "")
        field.value = "YOUR NAME";
    if(obj == 'recipientname' && field.value == "")
        field.value = "RECIPIENT'S NAME";
    if(obj == 'message' && field.value == "")
        field.value = "WRITE YOUR MESSAGE HERE";
}
*/

function shareItem(id,type,shareURL) {
	var lettersWithSpace     = /^[a-zA-Z\s]+$/;
	var to             = document.getElementById('to');
	//var email          = document.getElementById('email');
	var name           = document.getElementById('name');
	var recipientname  = document.getElementById('recipientname');
	var subject        = document.getElementById('subject');
	

    var toValue = to.value;
    if(toValue == "ENTER RECIPIENT&acute;S EMAIL") {
		toValue = "";
	}
    /*var emailValue = email.value;    
    if(emailValue == "ENTER SENDER&acute;S EMAIL")
        emailValue = "";
    */
	
    var nameValue = name.value;    
    if(nameValue == "YOUR NAME")
        nameValue = "";
        
    var recipientnameValue = recipientname.value;            
    if(recipientnameValue == "RECIPIENT&acute;S NAME")
        recipientnameValue = "RECIPIENT&acute;S NAME";
        
    var subjectValue = subject.value;     
    if(subjectValue == "WRITE YOUR MESSAGE HERE")
        subjectValue = "";
    
	//alert(toValue);
	
	if(nameValue == ""){
		 alert("Enter name. Only letters");
		 name.focus();
		 return false;
	}else if(nameValue != ''){
	    if(!nameValue.match(lettersWithSpace)) {
		    alert("Enter name. Only letters");
		    name.focus();
		    return false;
        }	
	}
	if(to.value == "ENTER RECIPIENT&acute;S EMAIL") {
		alert("Email address not entered or invalid. Please re-enter. [to]")
		to.focus();
		return false;
	}else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(toValue))){
		alert("Email address not entered or invalid. Please re-enter. [to]")
		to.focus();
		return false;
	}else if(recipientname.value == "") {
		alert("Enter recipient name.");
		recipientname.focus();
		return false;
	}else if(!recipientnameValue.match(lettersWithSpace)) {
		alert("Enter recipient name. Only letters");
		recipientname.focus();
		return false;
	}
	
	if(subject.value == "WRITE YOUR MESSAGE HERE") {
		alert("Enter message");
		subject.focus();
		return false;
	}else if(subject.value == "") {
		alert("Enter message");
		subject.focus();
		return false;
	}
	
	/*
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(toValue))){
		alert("Email address not entered or invalid. Please re-enter. [to]")
		to.focus();
		return false;
	}else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailValue))){
		alert("Email address not entered or invalid. Please re-enter. [from]")
		email.focus();
		return false;
	}else if(nameValue != ''){
	    if(!nameValue.match(lettersWithSpace)) {
		    alert("Enter name. Only letters");
		    name.focus();
		    return false;
        }	
	}*/
	
	
    url = '/index.php?method=shareItem'
    url += '&ID='+id;
    url += '&type='+type;
    //url += '&from=' + emailValue;
    url += '&to=' + toValue;
    url += '&name=' + escape(nameValue);
    url += '&recipientname=' + escape(recipientnameValue);
    url += '&subject=' + escape(subjectValue);
    url += '&url='+escape(shareURL);
    
    dcsMultiTrack("DCSext.method","shareItem","DCSext.ID",id,"DCSext.type",type);
    
    xmlHttpRequestCallCenter(url,'popupcontent',350,150);
    
	return true;
}



/* -- Comments Popup Metods : ============================================================= */

function showCommentPopup(itemID){

    url = '/index.php?method=showCommentPopup&itemID='+itemID;

	centerDivAbs('popupcontent',575,500);
	showpopup('popupcontent');
	xmlHttpRequestCallCenter(url,'popupcontent',575,500);
}

function clearCommentPopup() {
    document.getElementById('firstname').value = "First Name";
	document.getElementById('lastname').value = "Last Name";
	document.getElementById('email').value = "Email";
	document.getElementById('comment').value = "";
} 

function focusCommentPopupFields(obj) {
    var field = document.getElementById(obj);
	if(field.value == 'First Name' || field.value == 'Last Name' || field.value == 'Email' )	
        field.value = "";
}


function blurCommentPopupFields(obj) {
    var field = document.getElementById(obj);
    if(obj == 'firstname' && field.value == "")
        field.value = "First Name";
    if(obj == 'lastname' && field.value == "")
        field.value = "Last Name";
    if(obj == 'email' && field.value == "")
        field.value = "Email";
}




function commentItem(itemID) {
	var lettersWithSpace     = /^[a-zA-Z\s]+$/;
	var firstname = document.getElementById('firstname');
	var lastname = document.getElementById('lastname');
	var email = document.getElementById('email');
	var comment = document.getElementById('comment');
	
	
    var firstnameValue = firstname.value;
    if(firstnameValue == "First Name"){
        firstnameValue = '';
    }

    var lastnameValue = lastname.value;
    if(lastnameValue == "Last Name"){
        lastnameValue = '';
    }

    var emailValue = email.value;
    if(emailValue == "Email"){
        emailValue = '';
    }
    
    var commentValue = comment.value; 
        
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailValue))){
		alert("Email address not entered or invalid. Please re-enter. [email]")
		email.focus();
		return false;
	}else if(firstnameValue != ''){
	    if(!firstnameValue.match(lettersWithSpace)) {
		    alert("Enter first name. Only letters");
		    firstname.focus();
		    return ;
        }	
	}else if(lastnameValue != ''){
	    if(!lastnameValue.match(lettersWithSpace)) {
		    alert("Enter last name. Only letters");
		    lastname.focus();
		    return ;
        }	
	}
	
    url = '/index.php?method=commentItem&itemID='+itemID;
    url += '&firstname=' + escape(firstnameValue);
    url += '&lastname=' + escape(lastnameValue);
    url += '&email=' + escape(emailValue);
    url += '&comment=' + escape(commentValue);
    
   var w = 575;
   var h = 215;
    xmlHttpRequestCallCenter(url,'popupcontent',w,h);
    
	return ;
}

function callCommentPopup(url) {
   var target = "popupcontent";
   var url = url;
   var w = 575;
   var h = 400;
   
   centerDivAbs(target,w,h);
   xmlHttpRequestCallCenter(url, target, w,h);
}
	
function callStayTunedPopup(url) {
   var target = "popupcontent";
   var url = url;
   var w = 350;
   var h = 150;
   
   centerDivAbs(target,w,h);
   xmlHttpRequestCallCenter(url, target, w,h);
}

/* My Profile Details --------------------------------------------------------------- */
function showMyProfileAlerts(url,w,h){
		divReg = document.getElementById('divMyProfileAlertsMainPopup');
		divReg.style.display = 'block';
		divReg.style.top = 0;
		divReg.style.left = 0; 
		divReg.style.width = '100%'; 
		divReg.style.height = '100%'; 
	
		centerDivAbs('divMainPopup',w,h);
		//xmlHttpRequestCall(url,'divMainPopup');
		xmlHttpRequestCallCenter(url, 'divMainPopup', w,h);
		
		if(document.getElementById("main_123"))
		{
            try{	
			    var mov = thisMovie("main_123");
			    mov.pauseFlashVideo();
			}catch(e){
			}
		}
}

function closeMyProfilePopup(){
		document.getElementById('divMainPopup').style.display = 'none';

		divReg = document.getElementById('divMyProfileAlertsMainPopup');
		divReg.style.width = '1px';
		divReg.style.height = '1px';
		divReg.style.display = 'none';
	
		var FObj = document.getElementById("main_123");
		if(FObj != null)
		{
			var mov = (thisMovie("main_123"));
			mov.dialogBoxClosed();
		}
	}

	
	



