/*
Author: Tony
Date: 2008-5-17
*/
function onSharePixGenderChanged(sex){
if(sex == 0){
$('sharePix_category').selectedIndex = 0;
$('sharePix_category').disabled = true;
$('sharePix_style').selectedIndex = 0;
$('sharePix_style').disabled = true;
$('sharePix_figure').selectedIndex = 0;
$('sharePix_figure').disabled = true;
}else{
$('ajaxArea_sharePix_category').innerHTML = ' ';
$('ajaxArea_sharePix_style').innerHTML = ' ';
$('ajaxArea_sharePix_figure').innerHTML = ' ';
$('sharePix_submit').disabled = true;
var ajaxReg = new Request({url: 'http://www.ilovepipo.com/member/ajax/ajaxGrabPhotoElements', method: 'get',
onSuccess: function(txt) {
var parts = txt.split('<|||>');
$('ajaxArea_sharePix_category').innerHTML = parts[0];
$('ajaxArea_sharePix_style').innerHTML = parts[1];
$('ajaxArea_sharePix_figure').innerHTML = parts[2];
$('sharePix_submit').disabled = false;
},
onFailure: function() {
// window.alert('Ajax執行出錯,位置: \n文件: \n行號:<48>');
}
});
ajaxReg.send('gender=' + sex);
}
}
function postSharePixWindowSubmit(){
if($('sharePix_nickname').value.Trim() == ''){
window.alert('plz enter the nickname!');
$('sharePix_nickname').focus();
return false;
}
if($('sharePix_gender').selectedIndex == 0){
window.alert('plz select gender!');
$('sharePix_gender').focus();
return false;
}
if($('sharePix_category').selectedIndex == 0){
window.alert('plz select pix category!');
$('sharePix_category').focus();
return false;
}
if($('sharePix_style').selectedIndex == 0){
window.alert('plz select pix style!');
$('sharePix_style').focus();
return false;
}
if($('sharePix_figure').selectedIndex == 0){
window.alert('plz select the figure!');
$('sharePix_figure').focus();
return false;
}
if($('sharePix_comment').value.Trim() == ''){
window.alert('plz enter the comment!');
$('sharePix_comment').focus();
return false;
}
$('sharePix_submit').disabled = true;
$('sharePix_imgLoading').style.visibility = 'visible';
var ajaxReg = new Request({url: 'http://www.ilovepipo.com/member/ajax/ajaxSavePhoto', method: 'post',
onSuccess: function(txt) {
$('sharePix_imgLoading').style.visibility = 'hidden';
if(txt == 'FALSE'){
window.alert('Failed to save photo, plz try again!');
$('sharePix_submit').disabled = false;
}else{
window.location.href = 'http://www.ilovepipo.com/browse/' + txt + '.html';
// window.alert(txt);
}
},
onFailure: function() {
// window.alert('Ajax執行出錯,位置: \n文件: \n行號:<111>');
}
});
params = 'name=' + $('sharePix_nickname').value;
params += '&gender=' + $('sharePix_gender').value;
params += '&pixcat=' + $('sharePix_category').value;
params += '&pixstyle=' + $('sharePix_style').value;
params += '&figure=' + $('sharePix_figure').value;
params += '&comment=' + $('sharePix_comment').value;
params += '&imgtype=' + $('sharePix_imgtype').value;
params += '&url=' + URLEncode($('sharePix_url').value);
if($('sharePix_imgtype').value == 'external'){
params += '&linkurl=' + URLEncode($('sharePix_linkurl').value);
// params += '&linkurl=' + base64encode($('sharePix_linkurl').value);
params += '&linkfunc=' + $('sharePix_linkfunc').value;
}else{
params += '&filename=' + $('sharePix_filename').value;
params += '&filedir=' + $('sharePix_filedir').value;
params += '&filepath=' + $('sharePix_filepath').value;
params += '&filename_noext=' + $('sharePix_filename_noext').value;
}
window.alert(params);
ajaxReg.send(params);
}
function grabPhoto(url, clicker){
if(url == ''){
window.alert("錯誤: 您沒有輸入圖片連接地址喔!");
}else{
var x = 0; var y = 0;
if(clicker){
x = getObjectLeft(clicker);
y = getObjectTop(clicker);
x -= 25;
if(IsIE){ y += 3;}else{ y -= 3; }
}
var loadingImage = showLoadingImage(x, y);
$('searchButton').innerHTML = ' ';
var ajaxReg = new Request({url: 'http://www.ilovepipo.com/member/ajax/ajaxGrabPhoto', method: 'get',
onSuccess: function(txt) {
hideLoadingImage(loadingImage);
$('searchButton').innerHTML = ' ';
if(txt == 'FALSE'){
openShareErrorWindow();
}else{
var checker = /^\s*<|URL|>(\.\w+)*\s*$/;
if(checker.test(txt)){
openSharePixWindow('external', txt.replace('<|URL|>', ''));
}else{
openSharePixWindow('internal', txt);
}
}
},
onFailure: function() {
// window.alert('Ajax執行出錯,位置: \n文件: \n行號:<170>');
}
});
// ajaxReg.send('url=' + URLEncode(url));
// ajaxReg.send();
ajaxReg.send('url=' + base64encode(url));
}
}
function openSharePixWindow(type, value){
var previewImageSource = '';
if(type == 'external'){
var parts = value.split('<|||>');
previewImageSource = parts[0];
var url = parts[0];
}else{
var parts = value.split('<|||>');
if(parts[1] != ''){
previewImageSource = 'uploadpic/' + parts[1] + '/' + parts[0];
}else{
previewImageSource = 'uploadpic/' + parts[0];
}
var url = parts[4];
}
var html = '
';
html += '';
html += '';
html += '';
html += '';
html += '為這張照片做個分類吧! ';
html += ' ';
html += ' ';
html += '';
html += '';
html += '';
html += ' ';
html += ' ';
html += '
';
html += ' ';
html += ' ';
html += '
';
var win = document.getElementById("sharePixWindow");
if (!win){
var win = document.createElement("div");
}
win.innerHTML = html;
win.id = "sharePixWindow";
if(win){
maskWindow();
var x = getObjectLeft( $('searchInput'));
var y = getObjectTop( $('searchBar'));
y += 25;
with(win.style){
display = 'block';
visibility = 'visible';
top = y + 'px';
left = x + 'px';
margin = '0px';
padding = "0px";
height = 'auto';
width = 'auto';
position = "absolute";
zIndex = "1000";
}
document.body.appendChild(win);
}
return win;
}
function openShareErrorWindow(){
var html = '';
html += '';
html += '';
html += '';
html += '';
html += '無法分享這個網址喔!請確認該網址是否正確。 ';
html += ' ';
html += ' ';
html += '';
html += '';
html += '錯誤:無法分享這個網址喔!請確認該網址是否正確。 ';
html += '';
html += ' ';
html += ' ';
html += '
';
html += ' ';
html += ' ';
html += '
';
var win = document.getElementById("sharePixErrorWindow");
if (!win){
var win = document.createElement("div");
}
win.innerHTML = html;
win.id = "sharePixErrorWindow";
if(win){
maskWindow();
var x = getObjectLeft( $('searchInput'));
var y = getObjectTop( $('searchBar'));
y += 25;
with(win.style){
display = 'block';
visibility = 'visible';
top = y + 'px';
left = x + 'px';
margin = '0px';
padding = "0px";
height = 'auto';
width = 'auto';
position = "absolute";
zIndex = "1000";
}
document.body.appendChild(win);
}
return win;
}
function closePopupWindow(win){
if(win){
win.style.display = "none";
win.style.visibility = "hidden";
unMaskWindow();
}
}
function displayTipWindow(id, content, width){
var x = getMouseX2() - 33;
var y = getMouseY2() - 6;
var win = document.getElementById(id);
if (!win){
var win = document.createElement("div");
}
if(width){
if(width == 'auto'){
var w = 'auto';
}else{
var w = width + 'px';
}
}else{
var w = 400 + 'px';
}
var html = '';
html += '';
if(IsIE){
html += ' ';
}else{
html += ' ';
}
html += ' ';
html += '';
html += '';
html += '';
html += '';
html += content;
html += '
';
html += '';
html += ' ';
html += ' ';
html += '
';
win.innerHTML = html;
win.id = id;
win.className = "profileTipWindowOutterBox";
if(win){
maskWindow();
with(win.style){
display = 'block';
visibility = 'visible';
top = y + 'px';
left = x + 'px';
margin = '0px';
padding = "10px";
position = "absolute";
width = w;
zIndex = "1000";
}
document.body.appendChild(win);
}
return win;
}
function disappearTipWindow(id){
if($(id)){
$(id).style.visibility = 'hidden';
$(id).style.display = 'none';
document.body.removeChild($(id));
unMaskWindow();
}
}
function disappearWindow(id){
if($(id)){
$(id).style.visibility = 'hidden';
$(id).style.display = 'none';
document.body.removeChild($(id));
unMaskWindow();
}
}
function openProfileWin1(id, title, content, width, height, cls){
var cWidth = getPageWidth();
var cHeight = getPageHeight();
var sL = getScrollLeft();
var sT = getScrollTop();
if(width > 0){
var l = (cWidth - width) / 2 + sL;
}else{
var l = (cWidth - 600) / 2 + sL;
}
if(height > 0){
var t = (cHeight - height) / 2 + sT;
}else{
var t = (cHeight - 600) / 2 + sT;
}
var win = document.getElementById(id);
if (!win){
var win = document.createElement("div");
}
if(width){
if(width == 'auto'){
var w = 'auto';
}else{
var w = width + 'px';
}
}else{
var w = 200 + 'px';
}
if(height){
if(height == 'auto'){
var h = 'auto';
}else{
var h = height + 'px';
}
}else{
var h = 200 + 'px';
}
if(!cls || cls == 'undefined'){
cls = 'defaultProfileWindow';
}
var html = '';
html += '';
html += '';
html += '';
html += '';
html += '' + title + ' ';
html += ' ';
html += ' ';
html += '';
html += ' ';
html += ' ';
html += '
';
html += ' ';
html += ' ';
html += '
';
html += '';
html += '';
html += '';
win.innerHTML = html;
win.id = id;
if(win){
maskWindow();
with(win.style){
display = 'block';
visibility = 'visible';
top = t + 'px';
left = l + 'px';
margin = '0px';
padding = "10px";
position = "absolute";
width = w;
height = h;
zIndex = "1000";
}
document.body.appendChild(win);
}
return win;
}
function openProfileDenyWin(id, title, content, width, height, cls){
var cWidth = getPageWidth();
var cHeight = getPageHeight();
var sL = getScrollLeft();
var sT = getScrollTop();
if(width > 0){
var l = (cWidth - width) / 2 + sL;
}else{
var l = (cWidth - 600) / 2 + sL;
}
if(height > 0){
var t = (cHeight - height) / 2 + sT;
}else{
var t = (cHeight - 600) / 2 + sT;
}
var win = document.getElementById(id);
if (!win){
var win = document.createElement("div");
}
if(width){
if(width == 'auto'){
var w = 'auto';
}else{
var w = width + 'px';
}
}else{
var w = 200 + 'px';
}
if(height){
if(height == 'auto'){
var h = 'auto';
}else{
var h = height + 'px';
}
}else{
var h = 200 + 'px';
}
if(!cls || cls == 'undefined'){
cls = 'defaultProfileWindow';
}
var html = '';
html += '';
html += '';
html += '';
html += '';
html += '' + title + ' ';
html += ' ';
html += ' ';
html += '';
html += ' ';
html += ' ';
html += '
';
html += ' ';
html += ' ';
html += '
';
html += '';
html += '';
html += '';
win.innerHTML = html;
win.id = id;
if(win){
maskWindow();
with(win.style){
display = 'block';
visibility = 'visible';
top = t + 'px';
left = l + 'px';
margin = '0px';
padding = "10px";
position = "absolute";
width = w;
height = h;
zIndex = "1000";
}
document.body.appendChild(win);
}
return win;
}
// ---------------------------------------------------------------------------------------------------------
// The Popup CallBack Functions Begin
function showMemberSpirits(param){
var ajax = new Request({url: 'http://www.ilovepipo.com/member/ajax/ajaxShowSpirit', method: 'get',
onSuccess: function(txt) {
$('jsMemberScore').innerHTML = txt;
},
onFailure: function() {
// window.alert('Ajax執行出錯,位置: \n文件: \n行號:<661>');
}
});
$('jsMemberScore').innerHTML = ' ';
if(param){
ajax.send(param);
}else{
ajax.send();
}
}
// The Popup CallBack Functions Begin
function showMemberSpirits2(param){
var parts = param.split('&');
var imgid = parts[1].replace('imgid=', '');
var ajax = new Request({url: 'http://www.ilovepipo.com/member/ajax/ajaxShowSpirit', method: 'get',
onSuccess: function(txt) {
$('jsScore' + imgid).innerHTML = txt;
},
onFailure: function() {
// window.alert('Ajax執行出錯,位置: \n文件: \n行號:<684>');
}
});
if(param){
ajax.send(param);
}else{
ajax.send();
}
}
function sendProfileWin2Cmd(winid, clicker, params){
if($('jsPoupUname') && $('jsPoupPass')){
var jsPopupLogin = true;
}else{
var jsPopupLogin = false;
}
var jsPopupIsSendMsg = false;
if($('jsPopupTitle') && $('jsPopupText')){
jsPopupIsSendMsg = true;
if($('jsPopupTitle').value.Trim() == '' || $('jsPopupText').value.Trim() == ''){
$('jsPopupError2').style.display = '';
$('jsPopupError2').innerHTML = '錯誤: 訊息的標題和内文不能為空,請重新填寫您的標題和内文。 ';
return false;
}
}
if(jsPopupLogin && ($('jsPoupUname').value.Trim() == '' || $('jsPoupPass').value.Trim() == '')){
$('jsPopupError').style.display = '';
$('jsPopupError').innerHTML = '錯誤: 帳號和密碼不能為空,請重新填寫您的帳號和密碼。 ';
}else{
if(jsPopupLogin){
$('jsPopupError').innerHTML = '';
$('jsPopupError').style.display = 'none';
if(jsPopupIsSendMsg){
$('jsPopupError2').innerHTML = '';
$('jsPopupError2').style.display = 'none';
}
}
clicker.disabled = true;
$('jsPopupSubmitLoadingImage').style.display = '';
var ajaxCmder = new Request({url: 'http://www.ilovepipo.com/member/ajax/ajaxActionHandler', method: 'post',
onSuccess: function(txt) {
var parts = txt.split('<|||>');
switch(parts[0]){
case 'false':
$('jsPopupError').style.display = '';
$('jsPopupError').innerHTML = parts[1] + ' ';
clicker.disabled = false;
$('jsPopupSubmitLoadingImage').style.display = 'none';
break;
case 'fatal':
txt = parts[1];
txt = ' ';
txt += ' ';
$('jsPopupContent').innerHTML = txt;
break;
case 'true':
txt = parts[1];
txt = ' ';
txt += ' ';
$('jsPopupContent').innerHTML = txt;
if(parts[2]){
if(parts[3]){
eval(parts[2] + '(\'' + parts[3] + '\');');
}else{
eval(parts[2] + '();');
}
}
break;
}
},
onFailure: function() {
clicker.disabled = false;
$('jsPopupSubmitLoadingImage').style.display = 'none';
// window.alert('Ajax執行出錯,位置: \n文件: \n行號:<770>');
}
});
if(jsPopupIsSendMsg){
if(params != ''){
// params += '&title=' + $('jsPopupTitle').value.Trim() + '&text=' + URLEncode($('jsPopupText').value.Trim());
params += '&title=' + $('jsPopupTitle').value.Trim() + '&text=' + $('jsPopupText').value.Trim();
}else{
// params = 'title=' + $('jsPopupTitle').value.Trim() + '&text=' + URLEncode($('jsPopupText').value.Trim());
params = 'title=' + $('jsPopupTitle').value.Trim() + '&text=' + $('jsPopupText').value.Trim();
}
}
if(params != ''){
if(jsPopupLogin){
ajaxCmder.send(params + '&login=yes&uname=' + $('jsPoupUname').value.Trim() + '&pass=' + $('jsPoupPass').value.Trim());
}else{
ajaxCmder.send(params);
}
}else{
ajaxCmder.send('login=yes');
}
}
}
function openProfileWinFactory(openerFunc, caller, params, id, title, content, width, height, cls){
var ajaxReg = new Request({url: 'http://www.ilovepipo.com/member/ajax/ajaxCheckLogin', method: 'get',
onSuccess: function(txt) {
if(txt == 'duplicate'){
content = '對不起,您不能重覆發送: %s !'.replace('%s', title);
openProfileDenyWin(id, title, content, width, height, cls);
}else{
var parts = txt.split('<|||>');
switch(parts[0]){
case 'true':
content += '
';
content += '';
eval(openerFunc + "('" + id + "','" + title + "','" + content + "','" + width + "','" + height + "','" + cls + "');");
break;
case 'false':
content += '您沒有登入系統!請先登入: ';
content += '';
content += '帳號: ';
content += ' 密碼: ';
content += '
';
content += '';
eval(openerFunc + "('" + id + "','" + title + "','" + content + "','" + width + "','" + height + "','" + cls + "');");
break;
case 'fatal':
txt = parts[1];
content = ' ';
content += ' ';
eval(openerFunc + "('" + id + "','" + title + "','" + content + "','" + width + "','" + height + "','" + cls + "');");
break;
}
}
},
onFailure: function() {
// window.alert('Ajax執行出錯,位置: \n文件: \n行號:<835>');
}
});
if(params != ''){
ajaxReg.send(params);
}else{
ajaxReg.send();
}
}
function openProfileWinFactory2(openerFunc, caller, params, id, title, content, width, height, cls){
var ajaxReg = new Request({url: 'http://www.ilovepipo.com/member/ajax/ajaxCheckLogin', method: 'get',
onSuccess: function(txt) {
if(txt == 'duplicate'){
content = '對不起,您不能重覆發送: %s !'.replace('%s', title);
openProfileDenyWin(id, title, content, width, height, cls);
}else{
var parts = txt.split('<|||>');
content = content + '';
content += '';
content += '
';
switch(parts[0]){
case 'true':
content += ' ';
eval(openerFunc + "('" + id + "','" + title + "','" + content + "','" + width + "','" + height + "','" + cls + "');");
break;
case 'false':
content += '您沒有登入系統!請先登入: ';
content += '';
content += '帳號: ';
content += ' 密碼: ';
content += '
';
content += '';
eval(openerFunc + "('" + id + "','" + title + "','" + content + "','" + width + "','" + height + "','" + cls + "');");
break;
case 'fatal':
txt = parts[1];
content = ' ';
content += ' ';
eval(openerFunc + "('" + id + "','" + title + "','" + content + "','" + width + "','" + height + "','" + cls + "');");
break;
}
}
},
onFailure: function() {
// window.alert('Ajax執行出錯,位置: \n文件: \n行號:<895>');
}
});
if(params != ''){
ajaxReg.send(params);
}else{
ajaxReg.send();
}
}
function openProfileWinMaker(id, title, content, width, height, cls){
var cWidth = getPageWidth();
var cHeight = getPageHeight();
var sL = getScrollLeft();
var sT = getScrollTop();
if(width > 0){
var l = (cWidth - width) / 2 + sL;
}else{
var l = (cWidth - 600) / 2 + sL;
}
if(height > 0){
var t = (cHeight - height) / 2 + sT;
}else{
var t = (cHeight - 200) / 2 + sT;
}
var win = document.getElementById(id);
if (!win){
var win = document.createElement("div");
}
if(width){
if(width == 'auto'){
var w = 'auto';
}else{
var w = width + 'px';
}
}else{
var w = 200 + 'px';
}
if(height){
if(height == 'auto'){
var h = 'auto';
}else{
var h = height + 'px';
}
}else{
var h = 200 + 'px';
}
if(!cls || cls == 'undefined'){
cls = 'defaultProfileWindow';
}
var html = '';
html += '';
html += '';
html += '';
html += '';
html += '' + title + ' ';
html += ' ';
html += ' ';
html += '';
html += '';
html += '';
html += '';
html += ' ';
html += '
';
html += ' ';
html += '
';
html += ' ';
html += ' ';
html += '
';
html += '';
html += '';
html += '';
win.innerHTML = html;
win.id = id;
if(win){
maskWindow();
with(win.style){
display = 'block';
visibility = 'visible';
top = t + 'px';
left = l + 'px';
margin = '0px';
padding = "10px";
position = "absolute";
width = w;
height = h;
zIndex = "1000";
}
document.body.appendChild(win);
}
return win;
}
function openProfileWinSendPrvMsg(id, title, content, width, height, cls){
var cWidth = getPageWidth();
var cHeight = getPageHeight();
var sL = getScrollLeft();
var sT = getScrollTop();
if(width > 0){
var l = (cWidth - width) / 2 + sL;
}else{
var l = (cWidth - 600) / 2 + sL;
}
if(height > 0){
var t = (cHeight - height) / 2 + sT;
}else{
var t = (cHeight - 200) / 2 + sT;
}
var win = document.getElementById(id);
if (!win){
var win = document.createElement("div");
}
if(width){
if(width == 'auto'){
var w = 'auto';
}else{
var w = width + 'px';
}
}else{
var w = 200 + 'px';
}
if(height){
if(height == 'auto'){
var h = 'auto';
}else{
var h = height + 'px';
}
}else{
var h = 200 + 'px';
}
if(!cls || cls == 'undefined'){
cls = 'defaultProfileWindow';
}
var html = '';
html += '';
html += '';
html += '';
html += '';
html += '' + title + ' ';
html += ' ';
html += ' ';
html += '';
html += '';
html += '';
html += '';
html += ' ';
html += '
';
html += ' ';
html += '
';
html += ' ';
html += ' ';
html += '
';
html += '';
html += '';
html += '';
win.innerHTML = html;
win.id = id;
if(win){
maskWindow();
with(win.style){
display = 'block';
visibility = 'visible';
top = t + 'px';
left = l + 'px';
margin = '0px';
padding = "10px";
position = "absolute";
width = w;
height = h;
zIndex = "1000";
}
document.body.appendChild(win);
}
return win;
}